I tried to override the default lengthNorm method with the suggestion in
this link
https://issues.apache.org/jira/browse/LUCENE-2187.
But it will not work because not every number of terms from 1 to 10 has an
unique score.
Here is my solution, which only works for shorter fields. Welcome any
critiques or better solutions
private float[] fs = {1.0f, 0.9f, 0.8f, 0.7f, 0.6f, 0.45f, 0.40f, 0.35f,
0.30f, 0.20f};
@Override
public float lengthNorm(String fieldName, int numTerms){
if (numTerms < 11 && numTerms > 0){
return fs[numTerms -1];
}
float result = super.lengthNorm(fieldName, numTerms);
if (result > 0.1875){
return 0.1875f;
}
return result;
}
Here is the fieldNorm from 1 to 10
>> # of terms lengthNorm
>> 1 1.0
>> 2 .875
>> 3 .75
>> 4 .625
>> 5 .5
>> 6 .4375
>> 7 .375
>> 8 .3125
>> 9 .25
>> 10 .1875
Qi
On Wed, Dec 29, 2010 at 9:00 AM, Ahmet Arslan <iorixxx@yahoo.com> wrote:
> > Test case
> > doc1 : test -- one two
> > three
> > doc2 : test, one two three
> > doc3 : one two three
> >
> > Search query : "one two three" by QueryParser and
> > StandardAnalyzer
> >
> > Question: why all of three documents have the same
> > score?
>
> As Ian said, length norm values of your all documents are the same.
> See Jay Hill's message at http://search-lucene.com/m/Qw6CZpvRjw/
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
|