You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kr...@apache.org on 2017/01/18 15:46:15 UTC
[10/16] lucene-solr:jira/solr-8593: SOLR-9975: add
SpellCheckComponentTest.testCollateExtendedResultsWithJsonNl method
SOLR-9975: add SpellCheckComponentTest.testCollateExtendedResultsWithJsonNl method
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/e816fbe2
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/e816fbe2
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/e816fbe2
Branch: refs/heads/jira/solr-8593
Commit: e816fbe233a9b667a9c30be63241c9400f5a0ebc
Parents: 637915b
Author: Christine Poerschke <cp...@apache.org>
Authored: Tue Jan 17 14:33:58 2017 +0000
Committer: Christine Poerschke <cp...@apache.org>
Committed: Tue Jan 17 15:55:51 2017 +0000
----------------------------------------------------------------------
.../component/SpellCheckComponentTest.java | 36 ++++++++++++++++++++
1 file changed, 36 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e816fbe2/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java
index 0e11d44..37d02d9 100644
--- a/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java
@@ -184,6 +184,42 @@ public class SpellCheckComponentTest extends SolrTestCaseJ4 {
@Test
+ public void testCollateExtendedResultsWithJsonNl() throws Exception {
+ final String q = "documemtsss broens";
+ final String jsonNl = "map";
+ final boolean collateExtendedResults = random().nextBoolean();
+ final List<String> testsList = new ArrayList<String>();
+ if (collateExtendedResults) {
+ testsList.add("/spellcheck/collations/collation/collationQuery=='document brown'");
+ testsList.add("/spellcheck/collations/collation/hits==0");
+ switch (jsonNl) {
+ case "map":
+ testsList.add("/spellcheck/collations/collation/misspellingsAndCorrections/documemtsss=='document'");
+ testsList.add("/spellcheck/collations/collation/misspellingsAndCorrections/broens=='brown'");
+ break;
+ default:
+ fail("unexpected json.nl choice: "+jsonNl);
+ break;
+ }
+ } else {
+ testsList.add("/spellcheck/collations/collation=='document brown'");
+ }
+ final String[] testsArray = new String[testsList.size()];
+ implTestCollateExtendedResultsWithJsonNl(q, jsonNl, collateExtendedResults, testsList.toArray(testsArray));
+ }
+
+ private void implTestCollateExtendedResultsWithJsonNl(String q, String jsonNl, boolean collateExtendedResults, String ... tests) throws Exception {
+ final SolrQueryRequest solrQueryRequest = req(
+ CommonParams.QT, rh,
+ CommonParams.Q, q,
+ "json.nl", jsonNl,
+ SpellCheckComponent.COMPONENT_NAME, "true",
+ SpellingParams.SPELLCHECK_COLLATE_EXTENDED_RESULTS, Boolean.toString(collateExtendedResults),
+ SpellingParams.SPELLCHECK_COLLATE, "true");
+ assertJQ(solrQueryRequest, tests);
+ }
+
+ @Test
public void testCorrectSpelling() throws Exception {
// Make sure correct spellings are signaled in the response
assertJQ(req("json.nl","map", "qt",rh, SpellCheckComponent.COMPONENT_NAME, "true",