SOLR-9331: Remove ReRankQuery's length constructor argument and member.

This commit is contained in:
Christine Poerschke 2016-08-10 16:01:19 +01:00
parent 64c99293d7
commit bc25a565d2
2 changed files with 6 additions and 10 deletions

View File

@ -253,6 +253,8 @@ Other Changes
* SOLR-9367: Improved TestInjection's randomization logic to use LuceneTestCase.random() (hossman) * SOLR-9367: Improved TestInjection's randomization logic to use LuceneTestCase.random() (hossman)
* SOLR-9331: Remove ReRankQuery's length constructor argument and member. (Christine Poerschke)
================== 6.1.0 ================== ================== 6.1.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release. Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

View File

@ -42,7 +42,6 @@ import org.apache.lucene.search.TopScoreDocCollector;
import org.apache.lucene.search.Weight; import org.apache.lucene.search.Weight;
import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRef;
import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.SolrParams; import org.apache.solr.common.params.SolrParams;
import org.apache.solr.handler.component.MergeStrategy; import org.apache.solr.handler.component.MergeStrategy;
import org.apache.solr.handler.component.QueryElevationComponent; import org.apache.solr.handler.component.QueryElevationComponent;
@ -91,10 +90,7 @@ public class ReRankQParserPlugin extends QParserPlugin {
double reRankWeight = localParams.getDouble(RERANK_WEIGHT, RERANK_WEIGHT_DEFAULT); double reRankWeight = localParams.getDouble(RERANK_WEIGHT, RERANK_WEIGHT_DEFAULT);
int start = params.getInt(CommonParams.START,CommonParams.START_DEFAULT); return new ReRankQuery(reRankQuery, reRankDocs, reRankWeight);
int rows = params.getInt(CommonParams.ROWS,CommonParams.ROWS_DEFAULT);
int length = start+rows;
return new ReRankQuery(reRankQuery, reRankDocs, reRankWeight, length);
} }
} }
@ -121,7 +117,6 @@ public class ReRankQParserPlugin extends QParserPlugin {
private Query mainQuery = defaultQuery; private Query mainQuery = defaultQuery;
final private Query reRankQuery; final private Query reRankQuery;
final private int reRankDocs; final private int reRankDocs;
final private int length;
final private double reRankWeight; final private double reRankWeight;
final private Rescorer reRankQueryRescorer; final private Rescorer reRankQueryRescorer;
private Map<BytesRef, Integer> boostedPriority; private Map<BytesRef, Integer> boostedPriority;
@ -142,11 +137,10 @@ public class ReRankQParserPlugin extends QParserPlugin {
reRankDocs == rrq.reRankDocs; reRankDocs == rrq.reRankDocs;
} }
public ReRankQuery(Query reRankQuery, int reRankDocs, double reRankWeight, int length) { public ReRankQuery(Query reRankQuery, int reRankDocs, double reRankWeight) {
this.reRankQuery = reRankQuery; this.reRankQuery = reRankQuery;
this.reRankDocs = reRankDocs; this.reRankDocs = reRankDocs;
this.reRankWeight = reRankWeight; this.reRankWeight = reRankWeight;
this.length = length;
this.reRankQueryRescorer = new ReRankQueryRescorer(reRankQuery, reRankWeight); this.reRankQueryRescorer = new ReRankQueryRescorer(reRankQuery, reRankWeight);
} }
@ -171,7 +165,7 @@ public class ReRankQParserPlugin extends QParserPlugin {
} }
} }
return new ReRankCollector(reRankDocs, length, reRankQueryRescorer, cmd, searcher, boostedPriority); return new ReRankCollector(reRankDocs, len, reRankQueryRescorer, cmd, searcher, boostedPriority);
} }
@Override @Override
@ -188,7 +182,7 @@ public class ReRankQParserPlugin extends QParserPlugin {
public Query rewrite(IndexReader reader) throws IOException { public Query rewrite(IndexReader reader) throws IOException {
Query q = mainQuery.rewrite(reader); Query q = mainQuery.rewrite(reader);
if (q != mainQuery) { if (q != mainQuery) {
return new ReRankQuery(reRankQuery, reRankDocs, reRankWeight, length).wrap(q); return new ReRankQuery(reRankQuery, reRankDocs, reRankWeight).wrap(q);
} }
return super.rewrite(reader); return super.rewrite(reader);
} }