Project

General

Profile

« Previous | Next » 

Revision 61000

[Library|Trunk]
Result landing: SEO fix: improve spam filter for authors (names that include 'nn')

View differences:

resultLanding.component.ts
671 671
        let common_authors = ["[s.n.]","null &na;","nn","(:unap)","(:null)","null anonymous","anonymous"];
672 672
        allow = allow &&  !(
673 673
          this.isKeyword(this.resultLandingInfo.title,common_titles) || this.isKeyword(this.resultLandingInfo.description,common_abstract) ||
674
          (this.resultLandingInfo.authors && this.hasKeyword(this.resultLandingInfo.authors.map(o => o.fullName).join(" "),common_authors))
674
          (this.resultLandingInfo.authors && this.hasKeyword("_"+this.resultLandingInfo.authors.map(o => o.fullName).join("_")+"_",common_authors, "_"))
675 675
        );
676 676
        // console.log("common content " + allow)
677 677
        if(!allow) {
......
683 683
      return false;
684 684
    }
685 685
  }
686
  private hasKeyword(value:string, words:string[]){
687
    return value?words.filter( word => { return value.toLowerCase().indexOf(word)!=-1}).length > 0:0;
686
  private hasKeyword(value:string, words:string[], wordSuffix = ""){
687
    return value?words.filter( word => { return value.toLowerCase().indexOf(wordSuffix + word + wordSuffix)!=-1}).length > 0:0;
688 688
  }
689 689
  private isKeyword(value:string, words:string[]){
690 690
    return value?words.filter( word => { return value.toLowerCase() == word}).length > 0:0;

Also available in: Unified diff