mirror of https://github.com/apache/lucene.git
SOLR-9114: NPE using TermVectorComponent, MoreLikeThisComponent in combination with ExactStatsCache
This commit is contained in:
parent
6693c261e5
commit
d34f549df6
|
@ -121,6 +121,8 @@ Bug Fixes
|
|||
|
||||
* SOLR-9979: Macro expansion should not be done in shard requests (Tomás Fernández Löbbe)
|
||||
|
||||
* SOLR-9114: NPE using TermVectorComponent, MoreLikeThisComponent in combination with ExactStatsCache (Cao Manh Dat, Varun Thacker)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -221,7 +221,17 @@ public class MoreLikeThisComponent extends SearchComponent {
|
|||
}
|
||||
super.finishStage(rb);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void modifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest sreq) {
|
||||
SolrParams params = rb.req.getParams();
|
||||
if (!params.getBool(COMPONENT_NAME, false)) return;
|
||||
if ((sreq.purpose & ShardRequest.PURPOSE_GET_MLT_RESULTS) == 0
|
||||
&& (sreq.purpose & ShardRequest.PURPOSE_GET_TOP_IDS) == 0) {
|
||||
sreq.params.set(COMPONENT_NAME, "false");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns NamedList based on the order of
|
||||
* resultIds.shardDoc.positionInResponse
|
||||
|
|
|
@ -464,6 +464,15 @@ public class TermVectorComponent extends SearchComponent implements SolrCoreAwar
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest sreq) {
|
||||
SolrParams params = rb.req.getParams();
|
||||
if (!params.getBool(COMPONENT_NAME, false)) return;
|
||||
if ((sreq.purpose & ShardRequest.PURPOSE_GET_FIELDS) == 0) {
|
||||
sreq.params.set(COMPONENT_NAME, "false");
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////// NamedListInitializedPlugin methods //////////////////////
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,11 +20,17 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||
import org.apache.lucene.util.TestUtil;
|
||||
import org.apache.solr.BaseDistributedSearchTestCase;
|
||||
import org.apache.solr.client.solrj.response.QueryResponse;
|
||||
import org.apache.solr.common.SolrDocumentList;
|
||||
import org.apache.solr.common.params.MoreLikeThisParams;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.search.stats.ExactStatsCache;
|
||||
import org.apache.solr.search.stats.LRUStatsCache;
|
||||
import org.apache.solr.search.stats.LocalStatsCache;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
|
@ -49,6 +55,23 @@ public class DistributedMLTComponentTest extends BaseDistributedSearchTestCase {
|
|||
requestHandlerName = "mltrh";
|
||||
super.distribSetUp();
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
int statsType = TestUtil.nextInt(random(), 1, 3);
|
||||
if (statsType == 1) {
|
||||
System.setProperty("solr.statsCache", ExactStatsCache.class.getName());
|
||||
} else if (statsType == 2) {
|
||||
System.setProperty("solr.statsCache", LRUStatsCache.class.getName());
|
||||
} else {
|
||||
System.setProperty("solr.statsCache", LocalStatsCache.class.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClass() {
|
||||
System.clearProperty("solr.statsCache");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ShardsFixed(num = 3)
|
||||
|
|
|
@ -18,9 +18,14 @@ package org.apache.solr.handler.component;
|
|||
|
||||
import org.apache.lucene.util.Constants;
|
||||
|
||||
import org.apache.lucene.util.TestUtil;
|
||||
import org.apache.solr.BaseDistributedSearchTestCase;
|
||||
import org.apache.solr.common.params.ShardParams;
|
||||
import org.apache.solr.common.params.TermVectorParams;
|
||||
import org.apache.solr.search.stats.ExactStatsCache;
|
||||
import org.apache.solr.search.stats.LRUStatsCache;
|
||||
import org.apache.solr.search.stats.LocalStatsCache;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -29,6 +34,19 @@ public class TermVectorComponentDistributedTest extends BaseDistributedSearchTes
|
|||
public static void betterNotBeJ9() {
|
||||
assumeFalse("FIXME: SOLR-5792: This test fails under IBM J9",
|
||||
Constants.JAVA_VENDOR.startsWith("IBM"));
|
||||
int statsType = TestUtil.nextInt(random(), 1, 3);
|
||||
if (statsType == 1) {
|
||||
System.setProperty("solr.statsCache", ExactStatsCache.class.getName());
|
||||
} else if (statsType == 2) {
|
||||
System.setProperty("solr.statsCache", LRUStatsCache.class.getName());
|
||||
} else {
|
||||
System.setProperty("solr.statsCache", LocalStatsCache.class.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClass() {
|
||||
System.clearProperty("solr.statsCache");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue