FAQ
Hello,
I'm trying to write a custom scorer that only uses the term frequency function from the DefaultSimilarity class, the problem is that documents with lower frequencies are returning with higher scores than documents with higher frequencies. Here's the code:
searcher.setSimilarity(new DefaultSimilarity(){
public float lengthNorm(String field, int numTerms){
return 1;
}
public float idf(int docFreq, int numDocs){
return 1;
}
public float coord(int overlap, int maxoverlap){
return 1;
}
public float queryNorm(float sumOfSquaredWeights){
return 1;
}
public float sloppyFreq(int distance){
return 1;
}
});
Any idea why this wouldn't be working?
Sincerely,
Chris Salem

Search Discussions

  • Grant Ingersoll at Aug 19, 2009 at 11:18 pm
    Are you setting the Similarity before indexing, too, on the IndexWriter?
    On Aug 19, 2009, at 4:20 PM, Chris Salem wrote:

    Hello,
    I'm trying to write a custom scorer that only uses the term
    frequency function from the DefaultSimilarity class, the problem is
    that documents with lower frequencies are returning with higher
    scores than documents with higher frequencies. Here's the code:
    searcher.setSimilarity(new DefaultSimilarity(){
    public float lengthNorm(String field, int numTerms){
    return 1;
    }
    public float idf(int docFreq, int numDocs){
    return 1;
    }
    public float coord(int overlap, int maxoverlap){
    return 1;
    }
    public float queryNorm(float sumOfSquaredWeights){
    return 1;
    }
    public float sloppyFreq(int distance){
    return 1;
    }
    });
    Any idea why this wouldn't be working?
    Sincerely,
    Chris Salem
    --------------------------
    Grant Ingersoll
    http://www.lucidimagination.com/

    Search the Lucene ecosystem (Lucene/Solr/Nutch/Mahout/Tika/Droids)
    using Solr/Lucene:
    http://www.lucidimagination.com/search


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: [email protected]
    For additional commands, e-mail: [email protected]
  • Chris Salem at Aug 20, 2009 at 1:26 pm
    No, I take it I have to use it for both? Is there anything else I should have to do?
    Sincerely,
    Chris Salem


    ----- Original Message -----
    To: [email protected]
    From: Grant Ingersoll <[email protected]>
    Sent: 8/19/2009 7:17:45 PM
    Subject: Re: custom scorer


    Are you setting the Similarity before indexing, too, on the IndexWriter?
    On Aug 19, 2009, at 4:20 PM, Chris Salem wrote:

    Hello,
    I'm trying to write a custom scorer that only uses the term
    frequency function from the DefaultSimilarity class, the problem is
    that documents with lower frequencies are returning with higher
    scores than documents with higher frequencies. Here's the code:
    searcher.setSimilarity(new DefaultSimilarity(){
    public float lengthNorm(String field, int numTerms){
    return 1;
    }
    public float idf(int docFreq, int numDocs){
    return 1;
    }
    public float coord(int overlap, int maxoverlap){
    return 1;
    }
    public float queryNorm(float sumOfSquaredWeights){
    return 1;
    }
    public float sloppyFreq(int distance){
    return 1;
    }
    });
    Any idea why this wouldn't be working?
    Sincerely,
    Chris Salem
    --------------------------
    Grant Ingersoll
    http://www.lucidimagination.com/

    Search the Lucene ecosystem (Lucene/Solr/Nutch/Mahout/Tika/Droids)
    using Solr/Lucene:
    http://www.lucidimagination.com/search


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: [email protected]
    For additional commands, e-mail: [email protected]
  • Simon Willnauer at Aug 20, 2009 at 1:30 pm
    You could simply set Similarity.setDefault(yourSimilarity) to make
    sure it is used all over the place.

    Simon

    On Thu, Aug 20, 2009 at 3:25 PM, Chris Salemwrote:
    No, I take it I have to use it for both?  Is there anything else I should have to do?
    Sincerely,
    Chris Salem


    ----- Original Message -----
    To: [email protected]
    From: Grant Ingersoll <[email protected]>
    Sent: 8/19/2009 7:17:45 PM
    Subject: Re: custom scorer


    Are you setting the Similarity before indexing, too, on the IndexWriter?
    On Aug 19, 2009, at 4:20 PM, Chris Salem wrote:

    Hello,
    I'm trying to write a custom scorer that only uses the term
    frequency function from the DefaultSimilarity class, the problem is
    that documents with lower frequencies are returning with higher
    scores than documents with higher frequencies. Here's the code:
    searcher.setSimilarity(new DefaultSimilarity(){
    public float lengthNorm(String field, int numTerms){
    return 1;
    }
    public float idf(int docFreq, int numDocs){
    return 1;
    }
    public float coord(int overlap, int maxoverlap){
    return 1;
    }
    public float queryNorm(float sumOfSquaredWeights){
    return 1;
    }
    public float sloppyFreq(int distance){
    return 1;
    }
    });
    Any idea why this wouldn't be working?
    Sincerely,
    Chris Salem
    --------------------------
    Grant Ingersoll
    http://www.lucidimagination.com/

    Search the Lucene ecosystem (Lucene/Solr/Nutch/Mahout/Tika/Droids)
    using Solr/Lucene:
    http://www.lucidimagination.com/search


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: [email protected]
    For additional commands, e-mail: [email protected]
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: [email protected]
    For additional commands, e-mail: [email protected]

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedAug 19, '09 at 8:20p
activeAug 20, '09 at 1:30p
posts4
users3
websitelucene.apache.org

People

Translate

site design / logo © 2023 Grokbase