lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpou...@apache.org
Subject svn commit: r1700598 - in /lucene/dev/trunk/lucene: ./ core/src/java/org/apache/lucene/search/ queries/src/java/org/apache/lucene/queries/ queries/src/java/org/apache/lucene/queries/function/
Date Tue, 01 Sep 2015 15:36:11 GMT
Author: jpountz
Date: Tue Sep  1 15:36:10 2015
New Revision: 1700598

URL: http://svn.apache.org/r1700598
Log:
LUCENE-6746: DisjunctionMaxQuery, BoostingQuery and BoostedQuery now create sub weights through
IndexSearcher.

Modified:
    lucene/dev/trunk/lucene/CHANGES.txt
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java
    lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/BoostingQuery.java
    lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/BoostedQuery.java

Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=1700598&r1=1700597&r2=1700598&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Tue Sep  1 15:36:10 2015
@@ -80,6 +80,9 @@ Optimizations
 * LUCENE-6756: MatchAllDocsQuery now has a dedicated BulkScorer for better
   performance when used as a top-level query. (Adrien Grand)
 
+* LUCENE-6746: DisjunctionMaxQuery, BoostingQuery and BoostedQuery now create
+  sub weights through IndexSearcher so that they can be cached. (Adrien Grand)
+
 Bug Fixes
 
 * LUCENE-6730: Hyper-parameter c is ignored in term frequency NormalizationH1.

Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java?rev=1700598&r1=1700597&r2=1700598&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java
(original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java
Tue Sep  1 15:36:10 2015
@@ -123,7 +123,7 @@ public class DisjunctionMaxQuery extends
     public DisjunctionMaxWeight(IndexSearcher searcher, boolean needsScores) throws IOException
{
       super(DisjunctionMaxQuery.this);
       for (Query disjunctQuery : disjuncts) {
-        weights.add(disjunctQuery.createWeight(searcher, needsScores));
+        weights.add(searcher.createWeight(disjunctQuery, needsScores));
       }
       this.needsScores = needsScores;
     }

Modified: lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/BoostingQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/BoostingQuery.java?rev=1700598&r1=1700597&r2=1700598&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/BoostingQuery.java
(original)
+++ lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/BoostingQuery.java
Tue Sep  1 15:36:10 2015
@@ -59,8 +59,8 @@ public class BoostingQuery extends Query
       if (needsScores == false) {
         return match.createWeight(searcher, needsScores);
       }
-      final Weight matchWeight = match.createWeight(searcher, needsScores);
-      final Weight contextWeight = context.createWeight(searcher, false);
+      final Weight matchWeight = searcher.createWeight(match, needsScores);
+      final Weight contextWeight = searcher.createWeight(context, false);
       return new Weight(this) {
 
         @Override

Modified: lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/BoostedQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/BoostedQuery.java?rev=1700598&r1=1700597&r2=1700598&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/BoostedQuery.java
(original)
+++ lucene/dev/trunk/lucene/queries/src/java/org/apache/lucene/queries/function/BoostedQuery.java
Tue Sep  1 15:36:10 2015
@@ -32,7 +32,6 @@ import org.apache.lucene.search.IndexSea
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.Scorer;
 import org.apache.lucene.search.Weight;
-import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.ToStringUtils;
 
 /**
@@ -74,7 +73,7 @@ public class BoostedQuery extends Query
     public BoostedWeight(IndexSearcher searcher, boolean needsScores) throws IOException
{
       super(BoostedQuery.this);
       this.searcher = searcher;
-      this.qWeight = q.createWeight(searcher, needsScores);
+      this.qWeight = searcher.createWeight(q, needsScores);
       this.fcontext = ValueSource.newContext(searcher);
       boostVal.createWeight(fcontext,searcher);
     }



Mime
View raw message