本文整理汇总了Java中org.apache.solr.common.params.SpellingParams类的典型用法代码示例。如果您正苦于以下问题:Java SpellingParams类的具体用法?Java SpellingParams怎么用?Java SpellingParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpellingParams类属于org.apache.solr.common.params包,在下文中一共展示了SpellingParams类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPhrase
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
@Test
public void testPhrase() throws IOException, Exception {
assertQ(req(CommonParams.QT, "standard",
CommonParams.Q, "foo:bobo AND foo:marley",
SpellingParams.SPELLCHECK_COLLATE, "true",
SpellingParams.SPELLCHECK_BUILD, "true",
SpellingParams.SPELLCHECK_COUNT, "10",
SpellingParams.SPELLCHECK_EXTENDED_RESULTS, "true",
DymReSearcher.COMPONENT_NAME, "true",
SpellCheckComponent.COMPONENT_NAME, "true")
,"//result[@name='spellchecked_response'][@numFound='7']"
,"//result[@name='response'][@numFound='0']"
,"//arr[@name='extended_spellchecker_suggestions']/str[1][.='foo:bob AND foo:marley']"
,"//arr[@name='extended_spellchecker_suggestions']/str[2][.='foo:bono AND foo:marley']"
);
}
示例2: testSingleWord
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
@Test
public void testSingleWord() {
assertQ(req(CommonParams.QT, "standard",
CommonParams.Q, "foo:bon",
SpellingParams.SPELLCHECK_COLLATE, "true",
SpellingParams.SPELLCHECK_BUILD, "true",
SpellingParams.SPELLCHECK_COUNT, "10",
SpellingParams.SPELLCHECK_EXTENDED_RESULTS, "true",
DymReSearcher.COMPONENT_NAME, "true",
SpellCheckComponent.COMPONENT_NAME, "true")
,"//result[@name='spellchecked_response'][@numFound='8']"
,"//result[@name='response'][@numFound='0']"
,"//arr[@name='extended_spellchecker_suggestions']/str[1][.='foo:bob']"
,"//arr[@name='extended_spellchecker_suggestions']/str[2][.='foo:bono']"
,"//lst[@name='extended_spellchecker_suggestions_hit_counts']/long[@name='foo:bob'][.='8']"
,"//lst[@name='extended_spellchecker_suggestions_hit_counts']/long[@name='foo:bono'][.='4']"
,"//result[@name='spellchecked_response']/doc[1]/str[@name='id'][.='2']"
,"//result[@name='spellchecked_response']/doc[2]/str[@name='id'][.='3']"
,"//result[@name='spellchecked_response']/doc[3]/str[@name='id'][.='5']"
,"//result[@name='spellchecked_response']/doc[4]/str[@name='id'][.='7']"
,"//result[@name='spellchecked_response']/doc[5]/str[@name='id'][.='8']"
,"//result[@name='spellchecked_response']/doc[6]/str[@name='id'][.='9']"
,"//result[@name='spellchecked_response']/doc[7]/str[@name='id'][.='10']"
,"//result[@name='spellchecked_response']/doc[8]/str[@name='id'][.='11']");
}
示例3: testFacetAndHighlight
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
@Test
public void testFacetAndHighlight() {
assertQ(req(CommonParams.QT, "standardGoodSuggestion",
CommonParams.Q, "foo:bobo AND foo:marley",
SpellingParams.SPELLCHECK_COLLATE, "true",
SpellingParams.SPELLCHECK_BUILD, "true",
SpellingParams.SPELLCHECK_COUNT, "10",
SpellingParams.SPELLCHECK_EXTENDED_RESULTS, "true",
FacetParams.FACET, "true",
FacetParams.FACET_FIELD, "foo",
FacetParams.FACET_FIELD, "id",
FacetParams.FACET_FIELD, "bar",
FacetParams.FACET_QUERY, "id:[0 TO 20]",
FacetParams.FACET_QUERY, "id:[1 TO 100]",
HighlightParams.HIGHLIGHT, "true",
HighlightParams.FIELDS, "foo",
DymReSearcher.COMPONENT_NAME, "true",
SpellCheckComponent.COMPONENT_NAME, "true")
,"//result[@name='spellchecked_response'][@numFound='7']"
,"//result[@name='response'][@numFound='0']"
,"//arr[@name='extended_spellchecker_suggestions']/str[1][.='foo:bob AND foo:marley']"
,"//lst[@name='spellchecked_facet_counts']/lst[@name='facet_fields']/lst[@name='foo']/int[@name='bob'][.='7']"
,"//lst[@name='spellchecked_facet_counts']/lst[@name='facet_fields']/lst[@name='foo']/int[@name='marley'][.='7']"
,"//lst[@name='spellchecked_highlighting']/lst[@name='2']/arr[@name='foo']/str[1]");
}
示例4: testFacetAndHighlightWithCommonMisspellings
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
@Test
public void testFacetAndHighlightWithCommonMisspellings() {
assertQ(req(CommonParams.QT, "standardResWithCommonMisspellings",
CommonParams.Q, "foo:bobo AND foo:marley",
SpellingParams.SPELLCHECK_COLLATE, "true",
SpellingParams.SPELLCHECK_BUILD, "true",
SpellingParams.SPELLCHECK_COUNT, "10",
SpellingParams.SPELLCHECK_EXTENDED_RESULTS, "true",
FacetParams.FACET, "true",
FacetParams.FACET_FIELD, "foo",
FacetParams.FACET_FIELD, "id",
FacetParams.FACET_FIELD, "bar",
FacetParams.FACET_QUERY, "id:[0 TO 20]",
FacetParams.FACET_QUERY, "id:[1 TO 100]",
HighlightParams.HIGHLIGHT, "true",
HighlightParams.FIELDS, "foo",
DymReSearcher.COMPONENT_NAME, "true",
SpellCheckComponent.COMPONENT_NAME, "true")
,"//result[@name='spellchecked_response'][@numFound='3']"
,"//result[@name='response'][@numFound='0']"
,"//arr[@name='extended_spellchecker_suggestions']/str[1][.='foo:bono AND foo:marley']"
,"//lst[@name='spellchecked_facet_counts']/lst[@name='facet_fields']/lst[@name='foo']/int[@name='bob'][.='3']"
,"//lst[@name='spellchecked_facet_counts']/lst[@name='facet_fields']/lst[@name='foo']/int[@name='marley'][.='3']"
,"//lst[@name='spellchecked_highlighting']/lst[@name='9']/arr[@name='foo']/str[1]"
);
}
示例5: testPhraseWithCorrectionHighlighting
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
@Test
public void testPhraseWithCorrectionHighlighting() {
assertQ(req(CommonParams.QT, "standard",
CommonParams.Q, "foo:bobo AND foo:marley",
SpellingParams.SPELLCHECK_COLLATE, "true",
SpellingParams.SPELLCHECK_BUILD, "true",
SpellingParams.SPELLCHECK_COUNT, "10",
SpellingParams.SPELLCHECK_EXTENDED_RESULTS, "true",
AbstractReSearcherComponent.RES_HIGHLIGHT_REPLACED_TAG_PARAM_NAME, "b",
DymReSearcher.COMPONENT_NAME, "true",
SpellCheckComponent.COMPONENT_NAME, "true")
,"//result[@name='spellchecked_response'][@numFound='7']"
,"//result[@name='response'][@numFound='0']"
,"//arr[@name='extended_spellchecker_suggestions']/str[1][.='foo:bob AND foo:marley']"
,"//arr[@name='extended_spellchecker_suggestions']/str[2][.='foo:bono AND foo:marley']"
,"//arr[@name='extended_spellchecker_suggestions_highlighted']/str[1][.='<b>foo:bob</b> AND foo:marley']"
,"//arr[@name='extended_spellchecker_suggestions_highlighted']/str[2][.='<b>foo:bono</b> AND foo:marley']"
);
}
示例6: testBugWithMultipleIncorrectWords
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
@Test
public void testBugWithMultipleIncorrectWords() {
// the bug occurs only when the second word is the one that should be changed
assertQ(req(CommonParams.QT, "standardIgnoreCollation",
CommonParams.Q, "foo:marlex AND foo:bobo",
SpellingParams.SPELLCHECK_COLLATE, "true",
SpellingParams.SPELLCHECK_BUILD, "true",
SpellingParams.SPELLCHECK_COUNT, "10",
SpellingParams.SPELLCHECK_EXTENDED_RESULTS, "true",
DymReSearcher.COMPONENT_NAME, "true",
SpellCheckComponent.COMPONENT_NAME, "true")
,"//result[@name='response'][@numFound='0']"
);
// it is enough to see that exception didn't occur; since both words are incorrect and ReS currently handles only one
// incorrect word, just one word will be fixed which still isn't enough to get any results (so suggestions wont be
// returned either).
}
示例7: test
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
@Test
@ShardsFixed(num = 2)
public void test() throws Exception {
handle.clear();
handle.put("QTime", SKIPVAL);
handle.put("timestamp", SKIPVAL);
handle.put("maxScore", SKIPVAL);
handle.put("responseHeader", SKIP);
handle.put("spellchecked_response", UNORDERED);
query(CommonParams.QT, "standardResWithCommonMisspellings",
ShardParams.SHARDS_QT, "standardResWithCommonMisspellings",
CommonParams.Q, "foo:bobo AND foo:marley",
SpellingParams.SPELLCHECK_COLLATE, "true",
SpellingParams.SPELLCHECK_BUILD, "true",
SpellingParams.SPELLCHECK_COUNT, "10",
SpellingParams.SPELLCHECK_EXTENDED_RESULTS, "true",
DymReSearcher.COMPONENT_NAME, "true",
SpellCheckComponent.COMPONENT_NAME, "true");
}
示例8: testSpellCheckResponse
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
@Test
public void testSpellCheckResponse() throws Exception {
getSolrServer();
server.deleteByQuery("*:*");
server.commit(true, true);
SolrInputDocument doc = new SolrInputDocument();
doc.setField("id", "111");
doc.setField(field, "Samsung");
server.add(doc);
server.commit(true, true);
SolrQuery query = new SolrQuery("*:*");
query.set(CommonParams.QT, "/spell");
query.set("spellcheck", true);
query.set(SpellingParams.SPELLCHECK_Q, "samsang");
QueryRequest request = new QueryRequest(query);
SpellCheckResponse response = request.process(server).getSpellCheckResponse();
Assert.assertEquals("samsung", response.getFirstSuggestion("samsang"));
}
示例9: testCorrectSpelling
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
@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",
"q","lowerfilt:lazy lowerfilt:brown", SpellingParams.SPELLCHECK_EXTENDED_RESULTS, "true")
,"/spellcheck/suggestions=={'correctlySpelled':true}"
);
assertJQ(req("json.nl","map", "qt",rh, SpellCheckComponent.COMPONENT_NAME, "true", "spellcheck.dictionary", "direct_lowerfilt",
"q","lowerfilt:lazy lowerfilt:brown", SpellingParams.SPELLCHECK_EXTENDED_RESULTS, "true")
,"/spellcheck/suggestions=={'correctlySpelled':true}"
);
assertJQ(req("json.nl","map", "qt",rh, SpellCheckComponent.COMPONENT_NAME, "true", "spellcheck.dictionary", "direct_lowerfilt",
"q","lakkle", SpellingParams.SPELLCHECK_EXTENDED_RESULTS, "true")
,"/spellcheck/suggestions/correctlySpelled==false"
);
}
示例10: test
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
public void test() {
assertQ(req("qt", URI, "q", "hokk", SpellingParams.SPELLCHECK_COUNT, "1"),
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='hokk']/int[@name='numFound'][.='1']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='hokk']/arr[@name='suggestion']/str[1][.='北海道']"
);
assertQ(req("qt", URI, "q", "ほっk", SpellingParams.SPELLCHECK_COUNT, "1"),
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ほっk']/int[@name='numFound'][.='1']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ほっk']/arr[@name='suggestion']/str[1][.='北海道']"
);
assertQ(req("qt", URI, "q", "ホッk", SpellingParams.SPELLCHECK_COUNT, "1"),
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ホッk']/int[@name='numFound'][.='1']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ホッk']/arr[@name='suggestion']/str[1][.='北海道']"
);
assertQ(req("qt", URI, "q", "ホッk", SpellingParams.SPELLCHECK_COUNT, "1"),
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ホッk']/int[@name='numFound'][.='1']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ホッk']/arr[@name='suggestion']/str[1][.='北海道']"
);
}
示例11: testWithMaxEdit2
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
public void testWithMaxEdit2() throws Exception {
assertQ(req("qt", URI_MIN_EDIT_2, "q", "chagn", SpellingParams.SPELLCHECK_COUNT, "3"),
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagn']/int[@name='numFound'][.='3']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagn']/arr[@name='suggestion']/str[1][.='chance']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagn']/arr[@name='suggestion']/str[2][.='change']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagn']/arr[@name='suggestion']/str[3][.='charge']"
);
assertQ(req("qt", URI_MIN_EDIT_2, "q", "chagr", SpellingParams.SPELLCHECK_COUNT, "3"),
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagr']/int[@name='numFound'][.='3']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagr']/arr[@name='suggestion']/str[1][.='chance']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagr']/arr[@name='suggestion']/str[2][.='change']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chagr']/arr[@name='suggestion']/str[3][.='charge']"
);
assertQ(req("qt", URI_MIN_EDIT_2, "q", "chacn", SpellingParams.SPELLCHECK_COUNT, "3"),
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chacn']/int[@name='numFound'][.='3']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chacn']/arr[@name='suggestion']/str[1][.='chance']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chacn']/arr[@name='suggestion']/str[2][.='change']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='chacn']/arr[@name='suggestion']/str[3][.='charge']"
);
}
示例12: testReload
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
@Test
public void testReload() throws Exception {
String leaveData = System.getProperty("solr.test.leavedatadir");
if (leaveData == null) leaveData = "";
System.setProperty("solr.test.leavedatadir", "true");
addDocs();
assertU(commit());
File data = initCoreDataDir;
String config = configString;
deleteCore();
initCoreDataDir = data;
configString = config;
initCore();
assertQ(req("qt", requestUri, "q", "ac", SpellingParams.SPELLCHECK_COUNT, "2", SpellingParams.SPELLCHECK_ONLY_MORE_POPULAR, "true"),
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ac']/int[@name='numFound'][.='2']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ac']/arr[@name='suggestion']/str[1][.='acquire']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ac']/arr[@name='suggestion']/str[2][.='accommodate']"
);
// restore the property
System.setProperty("solr.test.leavedatadir", leaveData);
}
示例13: testMultiple
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
public void testMultiple() throws Exception {
assertQ(req("qt", URI_DEFAULT, "q", "japan", SpellingParams.SPELLCHECK_COUNT, "2"),
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/int[@name='numFound'][.='2']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/arr[@name='suggestion']/str[1][.='<b>Japan</b>ese Autocomplete and <b>Japan</b>ese Highlighter broken']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/arr[@name='suggestion']/str[2][.='Add <b>Japan</b>ese Kanji number normalization to Kuromoji']"
);
assertQ(req("qt", URI_DEFAULT, "q", "japan", SpellingParams.SPELLCHECK_COUNT, "3"),
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/int[@name='numFound'][.='3']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/arr[@name='suggestion']/str[1][.='<b>Japan</b>ese Autocomplete and <b>Japan</b>ese Highlighter broken']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/arr[@name='suggestion']/str[2][.='Add <b>Japan</b>ese Kanji number normalization to Kuromoji']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/arr[@name='suggestion']/str[3][.='Add decompose compound <b>Japan</b>ese Katakana token capability to Kuromoji']"
);
assertQ(req("qt", URI_DEFAULT, "q", "japan", SpellingParams.SPELLCHECK_COUNT, "4"),
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/int[@name='numFound'][.='3']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/arr[@name='suggestion']/str[1][.='<b>Japan</b>ese Autocomplete and <b>Japan</b>ese Highlighter broken']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/arr[@name='suggestion']/str[2][.='Add <b>Japan</b>ese Kanji number normalization to Kuromoji']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='japan']/arr[@name='suggestion']/str[3][.='Add decompose compound <b>Japan</b>ese Katakana token capability to Kuromoji']"
);
}
示例14: testReload
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
@Test
public void testReload() throws Exception {
String leaveData = System.getProperty("solr.test.leavedatadir");
if (leaveData == null) leaveData = "";
System.setProperty("solr.test.leavedatadir", "true");
addDocs();
assertU(commit());
File data = dataDir;
String config = configString;
deleteCore();
dataDir = data;
configString = config;
initCore();
assertQ(req("qt", requestUri, "q", "ac", SpellingParams.SPELLCHECK_COUNT, "2", SpellingParams.SPELLCHECK_ONLY_MORE_POPULAR, "true"),
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ac']/int[@name='numFound'][.='2']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ac']/arr[@name='suggestion']/str[1][.='acquire']",
"//lst[@name='spellcheck']/lst[@name='suggestions']/lst[@name='ac']/arr[@name='suggestion']/str[2][.='accommodate']"
);
// restore the property
System.setProperty("solr.test.leavedatadir", leaveData);
}
示例15: testQueryCorrectlySpelled
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
@Test
public void testQueryCorrectlySpelled() {
assertQ(req(CommonParams.QT, "standard",
CommonParams.Q, "foo:bob AND foo:marley",
SpellingParams.SPELLCHECK_COLLATE, "true",
SpellingParams.SPELLCHECK_BUILD, "true",
SpellingParams.SPELLCHECK_COUNT, "10",
SpellingParams.SPELLCHECK_EXTENDED_RESULTS, "true",
DymReSearcher.COMPONENT_NAME, "true",
SpellCheckComponent.COMPONENT_NAME, "true")
,"//result[@name='response'][@numFound='7']");
}