mirror of https://github.com/apache/lucene.git
SOLR-9217: delay JoinUtil call to createWeight for score join
This commit is contained in:
parent
99ce234162
commit
a07ac63357
|
@ -187,6 +187,9 @@ Optimizations
|
|||
* SOLR-10499: facet.heatmap is now significantly faster when the docset (base query) matches everything and there are no
|
||||
deleted docs. It's also faster when the docset matches a small fraction of the index or none. (David Smiley)
|
||||
|
||||
* SOLR-9217: Reduced heap consumption for filter({!join ... score=...})
|
||||
(Andrey Kudryavtsev, Gopikannan Venugopalsamy via Mikhail Khludnev)
|
||||
|
||||
Bug Fixes
|
||||
----------------------
|
||||
* SOLR-10281: ADMIN_PATHS is duplicated in two places and inconsistent. This can cause automatic
|
||||
|
|
|
@ -21,8 +21,9 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
|
||||
import org.apache.lucene.index.DocValuesType;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.search.IndexSearcher;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.Weight;
|
||||
import org.apache.lucene.search.join.JoinUtil;
|
||||
import org.apache.lucene.search.join.ScoreMode;
|
||||
import org.apache.solr.cloud.ZkController;
|
||||
|
@ -86,7 +87,7 @@ public class ScoreJoinQParserPlugin extends QParserPlugin {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Query rewrite(IndexReader reader) throws IOException {
|
||||
public Weight createWeight(IndexSearcher searcher, boolean needsScores, float boost) throws IOException {
|
||||
SolrRequestInfo info = SolrRequestInfo.getRequestInfo();
|
||||
|
||||
CoreContainer container = info.getReq().getCore().getCoreContainer();
|
||||
|
@ -106,7 +107,7 @@ public class ScoreJoinQParserPlugin extends QParserPlugin {
|
|||
fromCore.close();
|
||||
fromHolder.decref();
|
||||
}
|
||||
return joinQuery.rewrite(reader);
|
||||
return joinQuery.rewrite(searcher.getIndexReader()).createWeight(searcher, needsScores, boost);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -156,11 +157,11 @@ public class ScoreJoinQParserPlugin extends QParserPlugin {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Query rewrite(IndexReader reader) throws IOException {
|
||||
public Weight createWeight(IndexSearcher searcher, boolean needsScores, float boost) throws IOException {
|
||||
SolrRequestInfo info = SolrRequestInfo.getRequestInfo();
|
||||
final Query jq = JoinUtil.createJoinQuery(fromField, true,
|
||||
toField, fromQuery, info.getReq().getSearcher(), scoreMode);
|
||||
return jq.rewrite(reader);
|
||||
return jq.rewrite(searcher.getIndexReader()).createWeight(searcher, needsScores, boost);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -170,10 +170,9 @@ public class TestScoreJoinQPNoScore extends SolrTestCaseJ4 {
|
|||
{
|
||||
final Query query = QParser.getParser(req.getParams().get("q"), req).getQuery();
|
||||
final Query rewrittenQuery = query.rewrite(req.getSearcher().getIndexReader());
|
||||
assertTrue(
|
||||
rewrittenQuery+" should be Lucene's",
|
||||
rewrittenQuery.getClass().getPackage().getName()
|
||||
.startsWith("org.apache.lucene"));
|
||||
assertEquals(rewrittenQuery+" is expected to be from Solr",
|
||||
ScoreJoinQParserPlugin.class.getPackage().getName(),
|
||||
rewrittenQuery.getClass().getPackage().getName());
|
||||
}
|
||||
{
|
||||
final Query query = QParser.getParser(
|
||||
|
|
Loading…
Reference in New Issue