You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jd...@apache.org on 2014/07/09 16:22:09 UTC
svn commit: r1609171 - in /lucene/dev/trunk/solr: CHANGES.txt
core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java
Author: jdyer
Date: Wed Jul 9 14:22:08 2014
New Revision: 1609171
URL: http://svn.apache.org/r1609171
Log:
SOLR-2853: unit test for "spellcheck.maxCollationTries=0"
Modified:
lucene/dev/trunk/solr/CHANGES.txt
lucene/dev/trunk/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java
Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1609171&r1=1609170&r2=1609171&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Wed Jul 9 14:22:08 2014
@@ -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 Components
Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java?rev=1609171&r1=1609170&r2=1609171&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/spelling/SpellCheckCollatorTest.java Wed Jul 9 14:22:08 2014
@@ -535,6 +535,33 @@ public class SpellCheckCollatorTest exte
);
}
- }
+ }
+ @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);
+ }
}