mirror of https://github.com/apache/lucene.git
LUCENE-6746: DisjunctionMaxQuery, BoostingQuery and BoostedQuery now create sub weights through IndexSearcher.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1700598 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7fd588f57f
commit
c196056b33
|
@ -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.
|
||||
|
|
|
@ -123,7 +123,7 @@ public class DisjunctionMaxQuery extends Query implements Iterable<Query> {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.apache.lucene.search.IndexSearcher;
|
|||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue