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

Christine Poerschke commented on SOLR-17471:
--------------------------------------------

Okay, this is slightly creative (perhaps too creative?) and I haven't fully 
researched it but conceptually it might be possible to unblock things as 
follows.

This should be the code change (but it won't build because there is no 4-arg 
constructor variant as yet):
{code}
- IBSimilarity sim = new IBSimilarity(distribution, lambda, normalization);
- sim.setDiscountOverlaps(discountOverlaps);
+ IBSimilarity sim = new IBSimilarity(distribution, lambda, normalization, 
discountOverlaps);
{code}

This code change should be behaviourally equivalent:
{code}
- IBSimilarity sim = new IBSimilarity(distribution, lambda, normalization);
- sim.setDiscountOverlaps(discountOverlaps);
+ IBSimilarity sim = new IBSimilarity(distribution, lambda, normalization) {
+   private final Similarity computeNormProxySimilarity = new 
BM25Similarity(discountOverlaps);
+   @Override
+   public long computeNorm(FieldInvertState state) {
+     return computeNormProxySimilarity.computeNorm(state);
+   }
+ };
{code}

It should be behaviourally equivalent on the assumptions if/that
* the {{getDiscountOverlaps}} getter is never called (and so it does not matter 
if it returns an incorrect value)
* the {{computeNorm}} is the only place that uses the {{discountOverlaps}} 
member
* the {{BM25Similarity.computeNorm}} implementation matches the 
{{IBSimilarity.computeNorm}} implementation (and neither implementation uses 
anything other than {{state}} and {{discountOverlaps}} in its implementation).

WDYT?

> upgrade to Lucene 9.12.0
> ------------------------
>
>                 Key: SOLR-17471
>                 URL: https://issues.apache.org/jira/browse/SOLR-17471
>             Project: Solr
>          Issue Type: Task
>            Reporter: Christine Poerschke
>            Priority: Major
>             Fix For: main (10.0), 9.8
>
>
> Creating and leaving this Jira open for (new) devs to grab.
> * https://lucene.apache.org/core/9_12_0/changes/Changes.html
> * https://github.com/apache/solr/blob/main/dev-docs/lucene-upgrade.md



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to