Apache Lucene open-source search software
SOLR-2853: unit test for "spellcheck.maxCollationTries=0"
James Dyer4007157b1487
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex ceaa9b569a7..0f169a641b0 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -196,6 +196,8 @@ Other Changes* SOLR-5596: Set system property zookeeper.forceSync=no for Solr test cases. (shalin)+* SOLR-2853: Add a unit test for the case when "spellcheck.maxCollationTries=0" (James Dyer)+================== 4.9.0 ==================Versions of Major Componentsdiff --git a/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java b/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.javaindex 8e0063bd095..f18419f1fbf 100644--- a/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java+++ b/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java@@ -535,6 +535,33 @@ public class SpellCheckCollatorTest extends SolrTestCaseJ4 {);}- }+ }+ @Test+ public void testZeroTries() throws Exception+ {+ SolrCore core = h.getCore();+ SearchComponent speller = core.getSearchComponent("spellcheck");+ assertTrue("speller is null and it shouldn't be", speller != null);++ ModifiableSolrParams params = new ModifiableSolrParams();+ params.add(SpellCheckComponent.COMPONENT_NAME, "true");+ params.add(SpellCheckComponent.SPELLCHECK_BUILD, "true");+ params.add(SpellCheckComponent.SPELLCHECK_COUNT, "10");+ params.add(SpellCheckComponent.SPELLCHECK_COLLATE, "true");+ params.add(SpellCheckComponent.SPELLCHECK_MAX_COLLATION_TRIES, "0");+ params.add(SpellCheckComponent.SPELLCHECK_MAX_COLLATIONS, "2");+ params.add(CommonParams.Q, "lowerfilt:(+fauth)");+ SolrRequestHandler handler = core.getRequestHandler("spellCheckCompRH");+ SolrQueryResponse rsp = new SolrQueryResponse();+ rsp.add("responseHeader", new SimpleOrderedMap());+ SolrQueryRequest req = new LocalSolrQueryRequest(core, params);+ handler.handleRequest(req, rsp);+ req.close();+ NamedList values = rsp.getValues();+ NamedList spellCheck = (NamedList) values.get("spellcheck");+ NamedList suggestions = (NamedList) spellCheck.get("suggestions");+ List<String> collations = suggestions.getAll("collation");+ assertTrue(collations.size() == 2);+ }}