[ 
https://issues.apache.org/jira/browse/LUCENE-7395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15392178#comment-15392178
 ] 

Uwe Schindler commented on LUCENE-7395:
---------------------------------------

I think the Solr one is a duplicate of this one. The problem already exists in 
Lucene, because it returns a static constant of 1 for those methods.

I have the feeling that PerFieldSimilarityWrapper should provide some 
"fallback" similraity (defaultSimilarity in Solr), too. Same as 
PerFieldAnalyzerWrapper. It is currently abstract and you have to implement the 
"per field" method. But for all those which do not use fields, it should also 
provide some abstract method to return a default for all methods in similarity 
that are not per-field.

> Query Norm and coordination factor not calculated when 
> PerFieldSimilarityWrapper is used 
> -----------------------------------------------------------------------------------------
>
>                 Key: LUCENE-7395
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7395
>             Project: Lucene - Core
>          Issue Type: Bug
>    Affects Versions: 5.3.1, 5.4.1
>            Reporter: Sascha Markus
>
> If any kind of similarity is defined and therefore the 
> SchemaSimilarityFactory is defined as global similarity the queryNorm is 
> always 1.0
> The PerFieldSimilarityWrapper delegates some of the methods to the desired 
> Similarity but misses to delegate public float queryNorm(float 
> valueForNormalization)
> Instead the IndexReader calls this method on the base class Similarity.
> The result is that all scores are much higher.
> I created a custom similarity which extends ClassicSimilarity.
> To have the calculation fixed I did a local "hotfix"  which always uses the 
> default similarity. Also wrong for some cases but fine in my scenario.
>   @Override
>   public float queryNorm(float valueForNormalization) {
>     return get("").queryNorm(valueForNormalization); // use default 
> similarity to calculate
>   }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to