Project

General

Profile

« Previous | Next » 

Revision 60750

[Library|Trunk]
- Cache Interceptor service: add explore home page search queries (stats numbers)
- Result Landing: enhance noindex filter (avoid common title/authors/abstract)
- Search module: remove unused module

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/cache-interceptor.service.ts
23 23

  
24 24
    "/projects/?format=json&refine=true&page=1&size=0&fields=funder",
25 25

  
26
    "/resources/?format=json&query=( oaftype exact datasource  )&refine=true&fields=datasourcetypeuiname&fields=country&fields=datasourceodsubjects&fields=datasourceodcontenttypes&fields=datasourcecompatibilityname&&type=datasources&page=0&size=0"
26
    "/resources/?format=json&query=( oaftype exact datasource  )&refine=true&fields=datasourcetypeuiname&fields=country&fields=datasourceodsubjects&fields=datasourceodcontenttypes&fields=datasourcecompatibilityname&&type=datasources&page=0&size=0",
27

  
28
    "/search/v2/api/datasources/count?format=json", "/search/v2/api/publications/count?format=json", "/search/v2/api/datasets/count?format=json", "/search/v2/api/software/count?format=json", "/search/v2/api/other/count?format=json",
29
    "relresulttype%3Dpublication"
27 30
  ];
28 31

  
29 32

  
......
41 44
  }
42 45

  
43 46
  public checkForCachedRequests(url){
44
    if(url.indexOf("refine=true") !== -1) {
47
    if(url.indexOf("refine=true") !== -1 || url.indexOf("/count?format=json") !== -1 || url.indexOf("relresulttype%3Dpublication") !== -1) {
45 48
      return this.cachingRequests.some(partUrl => (url.indexOf(partUrl) !== -1));
46 49
    }
47 50
    return false;
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/find/searchAll.module.ts
10 10
import {ProjectsServiceModule} from '../../services/projectsService.module';
11 11
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
12 12
import {OrganizationsServiceModule} from '../../services/organizationsService.module';
13
import {BrowseEntitiesModule} from '../searchUtils/browseEntities.module';
14 13
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
15 14

  
16 15
import {PiwikServiceModule} from '../../utils/piwik/piwikService.module';
......
28 27
    CommonModule, FormsModule, RouterModule,
29 28
    DataProvidersServiceModule, ProjectsServiceModule,
30 29
    SearchResearchResultsServiceModule, OrganizationsServiceModule,
31
    BrowseEntitiesModule, SearchResultsModule, PiwikServiceModule, Schema2jsonldModule, SEOServiceModule, AdvancedSearchFormModule, SearchResearchResultsModule,  SearchProjectsModule, SearchOrganizationsModule, SearchDataProvidersModule
30
     SearchResultsModule, PiwikServiceModule, Schema2jsonldModule, SEOServiceModule, AdvancedSearchFormModule, SearchResearchResultsModule,  SearchProjectsModule, SearchOrganizationsModule, SearchDataProvidersModule
32 31
  ],
33 32
  declarations: [
34 33
    SearchAllComponent
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/newSearchPage.component.html
224 224
                  </svg>
225 225
                </span>
226 226
                <span>Filters <span
227
                    *ngIf="(selectedRangeFilters+selectedFilters) > 0">({{(selectedRangeFilters + selectedFilters)}}
228
                  )</span></span>
227
                    *ngIf="(selectedRangeFilters+selectedFilters) > 0">({{(selectedRangeFilters + selectedFilters)}})</span></span>
229 228
                <!--                <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1">-->
230 229
                <!--                  <rect x="6" y="4" width="12" height="1"></rect><rect x="6" y="9" width="12" height="1"></rect>-->
231 230
                <!--                  <rect x="6" y="14" width="12" height="1"></rect>-->
modules/uoa-services-library/trunk/ng-openaire-library/src/app/landingPages/result/resultLanding.component.ts
641 641
            || (this.resultLandingInfo.supplementedByResearchResults && this.resultLandingInfo.supplementedByResearchResults.length > 0)
642 642
          )
643 643
       );
644
       //words to exclude
644
       //spam words to exclude
645 645
        let title_authors_words = ["movie","hd","film","kimetsu", "1080p","4k","call of duty", "mobile hack", "TUBYDI"];
646 646
        let abstract_words = ["operacao-feliz-natal.blogspot.com", "moviedouban.site", "hack-expert-solution.link"];
647 647
        allow = allow &&  !(
648
          (this.hasKeyword(this.resultLandingInfo.title.toLowerCase(),title_authors_words) || (this.resultLandingInfo.authors && this.hasKeyword(this.resultLandingInfo.authors.join(" ").toLowerCase(),title_authors_words))
649
            || (this.resultLandingInfo.description && this.hasKeyword(this.resultLandingInfo.description.toLowerCase(),abstract_words))
648
          (this.hasKeyword(this.resultLandingInfo.title,title_authors_words) || (this.resultLandingInfo.authors && this.hasKeyword(this.resultLandingInfo.authors.map(o => o.fullName).join(" "),title_authors_words))
649
            || (this.resultLandingInfo.description && this.hasKeyword(this.resultLandingInfo.description,abstract_words))
650 650
          ) &&
651 651
          (this.resultLandingInfo.publisher == "Zenodo" ||
652
            this.resultLandingInfo.hostedBy_collectedFrom.filter( value => {return value.downloadName && value.downloadName.toLowerCase().indexOf("zenodo")!=-1}).length > 0));
652
            this.resultLandingInfo.hostedBy_collectedFrom.filter( value => {return value.downloadName && value.downloadName.indexOf("zenodo")!=-1}).length > 0));
653
        //common titles/ description / authors
654
        let common_titles = ["introduction", "editorial", "book reviews", "preface", "reviews", "none", "book review", "foreword", "conclusion", "review", "reply","einleitung","short notices","erratum","discussion", "letters to the editor","letter to the editor","reviews of books",":{unav)","editorial board"];
655
        let common_abstract = ["international audience","n/a","peer reviewed","national audience","info:eu-repo/semantics/published","-",".","graphical abstract","met lit. opg","international audience; no abstract",'<jats:p>.</jats:p>',"politics","info:eu-repo/semantics/publishedversion","copia digital. madrid : ministerio de educación, cultura y deporte, 2016",'<jats:p />',"peer-reviewed","copia digital. madrid : ministerio de educación, cultura y deporte. subdirección general de coordinación bibliotecaria, 2015","<jats:p>-</jats:p>","imperial users only","yüksek lisans"];
656
        let common_authors = ["[s.n.]","null &na;","nn","(:unap)","(:null)","null anonymous","anonymous"];
657
        allow = allow &&  !(
658
          this.isKeyword(this.resultLandingInfo.title,common_titles) || this.isKeyword(this.resultLandingInfo.description,common_abstract) ||
659
          (this.resultLandingInfo.authors && this.hasKeyword(this.resultLandingInfo.authors.map(o => o.fullName).join(" "),common_authors))
660
        );
653 661
        if(!allow) {
654 662
          this._meta.updateTag({content: 'noindex'}, "name='robots'");
655 663
        }
......
660 668
    }
661 669
  }
662 670
  private hasKeyword(value:string, words:string[]){
663
    return words.filter( word => { return value.indexOf(word)!=-1}).length > 0;
671
    return words.filter( word => { return value.toLowerCase().indexOf(word)!=-1}).length > 0;
664 672
  }
673
  private isKeyword(value:string, words:string[]){
674
    return words.filter( word => { return value.toLowerCase() == word}).length > 0;
675
  }
665 676
}

Also available in: Unified diff