FAQ
Hi

If I choose to subclass the default similarity, do I need to apply the same
subclassed Similarity to IndexReader, IndexWriter and IndexSearcher?

I am interested in doing the below:

Similarity sim = new DefaultSimilarity() {
public float lengthNorm(String field, int numTerms) {
if(field.equals("body")) return (float) (0.1 * Math.log(numTerms));
else return super.lengthNorm(field, numTerms);
}
}

[taken from http://www.lucenetutorial.com/advanced-topics/scoring.html]

Is this approach advisable?


Cheers
Amin

Search Discussions

  • Amin Mohammed-Coleman at Mar 20, 2009 at 4:28 pm
    Allthough (I could be wrong) but I'm wondering if the lenthNorm is the
    correct one I should be overriding. I'm interested in the number of times a
    term occurs found in a document (more occurance the higher the score) which
    I believe is coord. I may well be i am barking up the wrong tree.

    Cheers
    Amin
    On Fri, Mar 20, 2009 at 4:20 PM, Amin Mohammed-Coleman wrote:

    Hi

    If I choose to subclass the default similarity, do I need to apply the
    same subclassed Similarity to IndexReader, IndexWriter and IndexSearcher?

    I am interested in doing the below:

    Similarity sim = new DefaultSimilarity() {
    public float lengthNorm(String field, int numTerms) {
    if(field.equals("body")) return (float) (0.1 * Math.log(numTerms));
    else return super.lengthNorm(field, numTerms);
    }
    }

    [taken from http://www.lucenetutorial.com/advanced-topics/scoring.html]

    Is this approach advisable?


    Cheers
    Amin

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedMar 20, '09 at 4:21p
activeMar 20, '09 at 4:28p
posts2
users1
websitelucene.apache.org

1 user in discussion

Amin Mohammed-Coleman: 2 posts

People

Translate

site design / logo © 2022 Grokbase