本文整理汇总了Java中org.apache.solr.common.params.SpellingParams类的典型用法代码示例。如果您正苦于以下问题:Java SpellingParams类的具体用法?Java SpellingParams怎么用?Java SpellingParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpellingParams类属于org.apache.solr.common.params包,在下文中一共展示了SpellingParams类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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']"
);
}
开发者ID:sematext,项目名称:solr-researcher,代码行数:17,代码来源:TestDymReSearcher.java
示例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']");
}
开发者ID:sematext,项目名称:solr-researcher,代码行数:26,代码来源:TestDymReSearcher.java
示例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]");
}
开发者ID:sematext,项目名称:solr-researcher,代码行数:26,代码来源:TestDymReSearcher.java
示例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]"
);
}
开发者ID:sematext,项目名称:solr-researcher,代码行数:27,代码来源:TestDymReSearcher.java
示例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']"
);
}
开发者ID:sematext,项目名称:solr-researcher,代码行数:20,代码来源:TestDymReSearcher.java
示例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).
}
开发者ID:sematext,项目名称:solr-researcher,代码行数:19,代码来源:TestDymReSearcher.java
示例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");
}
开发者ID:sematext,项目名称:solr-researcher,代码行数:21,代码来源:TestDistributedDymReSearcher.java
示例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"));
}
开发者ID:europeana,项目名称:search,代码行数:20,代码来源:TestSpellCheckResponse.java
示例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"
);
}
开发者ID:europeana,项目名称:search,代码行数:17,代码来源:SpellCheckComponentTest.java
示例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][.='北海道']"
);
}
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:TestAnalyzedSuggestions.java
示例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']"
);
}
开发者ID:europeana,项目名称:search,代码行数:24,代码来源:TestFuzzyAnalyzedSuggestions.java
示例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);
}
开发者ID:europeana,项目名称:search,代码行数:23,代码来源:SuggesterTest.java
示例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']"
);
}
开发者ID:europeana,项目名称:search,代码行数:21,代码来源:TestAnalyzeInfixSuggestions.java
示例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);
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:23,代码来源:SuggesterTest.java
示例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']");
}
开发者ID:sematext,项目名称:solr-researcher,代码行数:13,代码来源:TestDymReSearcher.java
示例16: testPhraseWithGoodSuggestionAlgorithm
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
@Test
public void testPhraseWithGoodSuggestionAlgorithm() {
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",
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']");
}
开发者ID:sematext,项目名称:solr-researcher,代码行数:15,代码来源:TestDymReSearcher.java
示例17: testOriginalAndSpellcheckedFacet
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
@Test
public void testOriginalAndSpellcheckedFacet() {
assertQ(req(CommonParams.QT, "standardGoodSuggestionAllowSomeOriginalResults",
CommonParams.Q, "foo:elvos OR foo:presley",
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='1']"
,"//arr[@name='extended_spellchecker_suggestions']/str[1][.='foo:elvis OR foo:presley']"
// check spellchecked facets:
,"//lst[@name='spellchecked_facet_counts']/lst[@name='facet_fields']/lst[@name='foo']/int[@name='elvi'][.='3']"
,"//lst[@name='spellchecked_facet_counts']/lst[@name='facet_fields']/lst[@name='foo']/int[@name='presley'][.='1']"
,"//lst[@name='spellchecked_facet_counts']/lst[@name='facet_fields']/lst[@name='foo']/int[@name='2'][.='1']"
// check original facets:
,"//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='foo']/int[@name='elvi'][.='1']"
,"//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='foo']/int[@name='presley'][.='1']"
);
}
开发者ID:sematext,项目名称:solr-researcher,代码行数:31,代码来源:TestDymReSearcher.java
示例18: testPhraseWithFgsAndCommonMisspellings
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
@Test
public void testPhraseWithFgsAndCommonMisspellings() {
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",
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']"
);
}
开发者ID:sematext,项目名称:solr-researcher,代码行数:16,代码来源:TestDymReSearcher.java
示例19: testSpellCheckResponse_Extended
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
@Test
public void testSpellCheckResponse_Extended() 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");
query.set(SpellingParams.SPELLCHECK_EXTENDED_RESULTS, true);
QueryRequest request = new QueryRequest(query);
SpellCheckResponse response = request.process(server).getSpellCheckResponse();
assertEquals("samsung", response.getFirstSuggestion("samsang"));
SpellCheckResponse.Suggestion sug = response.getSuggestion("samsang");
List<SpellCheckResponse.Suggestion> sugs = response.getSuggestions();
assertEquals(sug.getAlternatives().size(), sug.getAlternativeFrequencies().size());
assertEquals(sugs.get(0).getAlternatives().size(), sugs.get(0).getAlternativeFrequencies().size());
assertEquals("samsung", sug.getAlternatives().get(0));
assertEquals("samsung", sugs.get(0).getAlternatives().get(0));
// basic test if fields were filled in
assertTrue(sug.getEndOffset()>0);
assertTrue(sug.getToken().length() > 0);
assertTrue(sug.getNumFound() > 0);
// assertTrue(sug.getOriginalFrequency() > 0);
// Hmmm... the API for SpellCheckResponse could be nicer:
response.getSuggestions().get(0).getAlternatives().get(0);
}
开发者ID:europeana,项目名称:search,代码行数:39,代码来源:TestSpellCheckResponse.java
示例20: getCustomParams
import org.apache.solr.common.params.SpellingParams; //导入依赖的package包/类
/**
* For every param that is of the form "spellcheck.[dictionary name].XXXX=YYYY, add
* XXXX=YYYY as a param to the custom param list
* @param params The original SolrParams
* @return The new Params
*/
protected SolrParams getCustomParams(String dictionary, SolrParams params) {
ModifiableSolrParams result = new ModifiableSolrParams();
Iterator<String> iter = params.getParameterNamesIterator();
String prefix = SpellingParams.SPELLCHECK_PREFIX + "." + dictionary + ".";
while (iter.hasNext()){
String nxt = iter.next();
if (nxt.startsWith(prefix)){
result.add(nxt.substring(prefix.length()), params.getParams(nxt));
}
}
return result;
}
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:SpellCheckComponent.java
注:本文中的org.apache.solr.common.params.SpellingParams类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论