You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Mike Klaas (JIRA)" <ji...@apache.org> on 2007/08/31 03:58:30 UTC

[jira] Commented: (LUCENE-850) Easily create queries that transform subquery scores arbitrarily

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

Mike Klaas commented on LUCENE-850:
-----------------------------------

Do address the issue above, the following needs to be added:
===================================================================
--- build-src/java/solr/org/apache/lucene/search/CustomBoostQuery.java  (revision 9312)
+++ build-src/java/solr/org/apache/lucene/search/CustomBoostQuery.java  (working copy)
@@ -280,7 +280,7 @@
 
     /*(non-Javadoc) @see org.apache.lucene.search.Scorer#score() */
     public float score() throws IOException {
-      float boostScore = (boostScorer==null ? 1 : boostScorer.score());
+      float boostScore = (boostScorer==null || subQueryScorer.doc() != boostScorer.doc() ? 1 : boos
tScorer.score());
       return qWeight * customScore(subQueryScorer.doc(), subQueryScorer.score(), boostScore);
     }
 
@@ -300,7 +300,8 @@
         return subQueryExpl;
       }
       // match
-      Explanation boostExpl = boostScorer==null ? null : boostScorer.explain(doc);
+      Explanation boostExpl = boostScorer==null ? null : 
+         weight.qStrict ? boostScorer.explain(doc) : weight.boostWeight.explain(reader,doc);
       Explanation customExp = customExplain(doc,subQueryExpl,boostExpl);
       float sc = qWeight * customExp.getValue();
       Explanation res = new ComplexExplanation(


> Easily create queries that transform subquery scores arbitrarily
> ----------------------------------------------------------------
>
>                 Key: LUCENE-850
>                 URL: https://issues.apache.org/jira/browse/LUCENE-850
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Search
>            Reporter: Mike Klaas
>         Attachments: CustomBoostQuery.java, prodscorer.patch.diff
>
>
> Refactor DisMaxQuery into SubQuery(Query|Scorer) that admits easy subclassing.  An example is given for multiplicatively combining scores.
> Note: patch is not clean; for demonstration purposes only.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org