diff --git a/solr/core/src/java/org/apache/solr/spelling/ConjunctionSolrSpellChecker.java b/solr/core/src/java/org/apache/solr/spelling/ConjunctionSolrSpellChecker.java index 86c6aac9dc1..9ce67213940 100644 --- a/solr/core/src/java/org/apache/solr/spelling/ConjunctionSolrSpellChecker.java +++ b/solr/core/src/java/org/apache/solr/spelling/ConjunctionSolrSpellChecker.java @@ -19,7 +19,6 @@ package org.apache.solr.spelling; import java.io.IOException; import java.util.ArrayList; -import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; @@ -136,12 +135,8 @@ public class ConjunctionSolrSpellChecker extends SolrSpellChecker { //TODO: This just interleaves the results. In the future, we might want to let users give each checker its // own weight and use that in combination to score & frequency to sort the results ? private SpellingResult mergeCheckers(SpellingResult[] results, int numSug) { - Map combinedTokenFrequency = new HashMap(); Map>> allSuggestions = new LinkedHashMap>>(); for(SpellingResult result : results) { - if(result.getTokenFrequency()!=null) { - combinedTokenFrequency.putAll(result.getTokenFrequency()); - } for(Map.Entry> entry : result.getSuggestions().entrySet()) { List> allForThisToken = allSuggestions.get(entry.getKey()); if(allForThisToken==null) { @@ -166,10 +161,6 @@ public class ConjunctionSolrSpellChecker extends SolrSpellChecker { anyData = true; Map.Entry corr = iter.next(); combinedResult.add(original, corr.getKey(), corr.getValue()); - Integer tokenFrequency = combinedTokenFrequency.get(original); - if(tokenFrequency!=null) { - combinedResult.addFrequency(original, tokenFrequency); - } if(++numberAdded==numSug) { break; } @@ -179,9 +170,7 @@ public class ConjunctionSolrSpellChecker extends SolrSpellChecker { break; } } - } - - + } return combinedResult; } diff --git a/solr/example/solr/conf/solrconfig.xml b/solr/example/solr/conf/solrconfig.xml index bd80e6ce088..762cddd928c 100755 --- a/solr/example/solr/conf/solrconfig.xml +++ b/solr/example/solr/conf/solrconfig.xml @@ -1245,7 +1245,7 @@ collations (re-written queries) can include a combination of corrections from both spellcheckers --> default - wordbreak + on true 10 diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java b/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java index 67ec83b826b..17d6890dea4 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java @@ -56,9 +56,10 @@ public class TestSpellCheckResponse extends SolrJettyTestBase { server.add(doc); server.commit(true, true); - SolrQuery query = new SolrQuery("name:samsang"); + SolrQuery query = new SolrQuery("*:*"); query.set(CommonParams.QT, "/spell"); query.set("spellcheck", true); + query.set(SpellingParams.SPELLCHECK_Q, "samsang"); query.set(SpellingParams.SPELLCHECK_BUILD, true); QueryRequest request = new QueryRequest(query); SpellCheckResponse response = request.process(server).getSpellCheckResponse();