本文整理汇总了Java中org.apache.solr.spelling.suggest.SuggesterParams类的典型用法代码示例。如果您正苦于以下问题:Java SuggesterParams类的具体用法?Java SuggesterParams怎么用?Java SuggesterParams使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SuggesterParams类属于org.apache.solr.spelling.suggest包,在下文中一共展示了SuggesterParams类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDocumentBased
import org.apache.solr.spelling.suggest.SuggesterParams; //导入依赖的package包/类
@Test
public void testDocumentBased() throws Exception {
assertQ(req("qt", rh,
SuggesterParams.SUGGEST_DICT, "suggest_fuzzy_doc_dict",
SuggesterParams.SUGGEST_BUILD, "true",
SuggesterParams.SUGGEST_Q, "exampel",
SuggesterParams.SUGGEST_COUNT, "2"),
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_dict']/lst[@name='exampel']/int[@name='numFound'][.='2']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_dict']/lst[@name='exampel']/arr[@name='suggestions']/lst[1]/str[@name='term'][.='example inputdata']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_dict']/lst[@name='exampel']/arr[@name='suggestions']/lst[1]/long[@name='weight'][.='45']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_dict']/lst[@name='exampel']/arr[@name='suggestions']/lst[2]/str[@name='term'][.='example data']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_dict']/lst[@name='exampel']/arr[@name='suggestions']/lst[2]/long[@name='weight'][.='40']"
);
assertQ(req("qt", rh,
SuggesterParams.SUGGEST_DICT, "suggest_fuzzy_doc_dict",
SuggesterParams.SUGGEST_BUILD, "true",
SuggesterParams.SUGGEST_Q, "Rad",
SuggesterParams.SUGGEST_COUNT, "2"),
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_dict']/lst[@name='Rad']/int[@name='numFound'][.='2']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_dict']/lst[@name='Rad']/arr[@name='suggestions']/lst[1]/str[@name='term'][.='Rad fox']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_dict']/lst[@name='Rad']/arr[@name='suggestions']/lst[1]/long[@name='weight'][.='35']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_dict']/lst[@name='Rad']/arr[@name='suggestions']/lst[2]/str[@name='term'][.='Red fox']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_dict']/lst[@name='Rad']/arr[@name='suggestions']/lst[2]/long[@name='weight'][.='30']"
);
}
示例2: testMultiSuggester
import org.apache.solr.spelling.suggest.SuggesterParams; //导入依赖的package包/类
@Test
public void testMultiSuggester() throws Exception {
assertQ(req("qt", rh,
SuggesterParams.SUGGEST_DICT, "suggest_fuzzy_doc_dict",
SuggesterParams.SUGGEST_DICT, "suggest_fuzzy_doc_expr_dict",
SuggesterParams.SUGGEST_BUILD, "true",
SuggesterParams.SUGGEST_Q, "exampel",
SuggesterParams.SUGGEST_COUNT, "2"),
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_dict']/lst[@name='exampel']/int[@name='numFound'][.='2']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_dict']/lst[@name='exampel']/arr[@name='suggestions']/lst[1]/str[@name='term'][.='example inputdata']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_dict']/lst[@name='exampel']/arr[@name='suggestions']/lst[1]/long[@name='weight'][.='45']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_dict']/lst[@name='exampel']/arr[@name='suggestions']/lst[2]/str[@name='term'][.='example data']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_dict']/lst[@name='exampel']/arr[@name='suggestions']/lst[2]/long[@name='weight'][.='40']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_expr_dict']/lst[@name='exampel']/int[@name='numFound'][.='2']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_expr_dict']/lst[@name='exampel']/arr[@name='suggestions']/lst[1]/str[@name='term'][.='example inputdata']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_expr_dict']/lst[@name='exampel']/arr[@name='suggestions']/lst[1]/long[@name='weight'][.='120']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_expr_dict']/lst[@name='exampel']/arr[@name='suggestions']/lst[2]/str[@name='term'][.='example data']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_expr_dict']/lst[@name='exampel']/arr[@name='suggestions']/lst[2]/long[@name='weight'][.='110']"
);
}
示例3: testBadSuggesterName
import org.apache.solr.spelling.suggest.SuggesterParams; //导入依赖的package包/类
@Test
public void testBadSuggesterName() throws Exception {
String fakeSuggesterName = "does-not-exist";
assertQEx("No suggester named " + fakeSuggesterName +" was configured",
req("qt", rh,
SuggesterParams.SUGGEST_DICT, fakeSuggesterName,
SuggesterParams.SUGGEST_Q, "exampel",
SuggesterParams.SUGGEST_COUNT, "2"),
SolrException.ErrorCode.BAD_REQUEST
);
assertQEx("'" + SuggesterParams.SUGGEST_DICT +
"' parameter not specified and no default suggester configured",
req("qt", rh,
SuggesterParams.SUGGEST_Q, "exampel",
SuggesterParams.SUGGEST_COUNT, "2"),
SolrException.ErrorCode.BAD_REQUEST
);
}
示例4: testExpressionBased
import org.apache.solr.spelling.suggest.SuggesterParams; //导入依赖的package包/类
@Test
public void testExpressionBased() throws Exception {
assertQ(req("qt", rh,
SuggesterParams.SUGGEST_DICT, "suggest_fuzzy_doc_expr_dict",
SuggesterParams.SUGGEST_BUILD, "true",
SuggesterParams.SUGGEST_Q, "exampel",
SuggesterParams.SUGGEST_COUNT, "2"),
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_expr_dict']/lst[@name='exampel']/int[@name='numFound'][.='2']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_expr_dict']/lst[@name='exampel']/arr[@name='suggestions']/lst[1]/str[@name='term'][.='example inputdata']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_expr_dict']/lst[@name='exampel']/arr[@name='suggestions']/lst[1]/long[@name='weight'][.='120']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_expr_dict']/lst[@name='exampel']/arr[@name='suggestions']/lst[2]/str[@name='term'][.='example data']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_doc_expr_dict']/lst[@name='exampel']/arr[@name='suggestions']/lst[2]/long[@name='weight'][.='110']"
);
}
示例5: testFileBased
import org.apache.solr.spelling.suggest.SuggesterParams; //导入依赖的package包/类
@Test
public void testFileBased() throws Exception {
assertQ(req("qt", rh,
SuggesterParams.SUGGEST_DICT, "suggest_fuzzy_file_based",
SuggesterParams.SUGGEST_BUILD, "true",
SuggesterParams.SUGGEST_Q, "chn",
SuggesterParams.SUGGEST_COUNT, "2"),
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_file_based']/lst[@name='chn']/int[@name='numFound'][.='2']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_file_based']/lst[@name='chn']/arr[@name='suggestions']/lst[1]/str[@name='term'][.='chance']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_file_based']/lst[@name='chn']/arr[@name='suggestions']/lst[1]/long[@name='weight'][.='1']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_file_based']/lst[@name='chn']/arr[@name='suggestions']/lst[2]/str[@name='term'][.='change']",
"//lst[@name='suggest']/lst[@name='suggest_fuzzy_file_based']/lst[@name='chn']/arr[@name='suggestions']/lst[2]/long[@name='weight'][.='1']"
);
}
示例6: testBuildAllSuggester
import org.apache.solr.spelling.suggest.SuggesterParams; //导入依赖的package包/类
@Test
public void testBuildAllSuggester() throws Exception {
assertQ(req("qt", rh,
SuggesterParams.SUGGEST_BUILD_ALL, "true",
SuggesterParams.SUGGEST_Q, "exampel",
SuggesterParams.SUGGEST_COUNT, "2"),
"//str[@name='command'][.='buildAll']"
);
assertQ(req("qt", rh,
SuggesterParams.SUGGEST_BUILD_ALL, "true"),
"//str[@name='command'][.='buildAll']"
);
}
示例7: testReloadAllSuggester
import org.apache.solr.spelling.suggest.SuggesterParams; //导入依赖的package包/类
@Test
public void testReloadAllSuggester() throws Exception {
assertQ(req("qt", rh,
SuggesterParams.SUGGEST_RELOAD_ALL, "true",
SuggesterParams.SUGGEST_Q, "exampel",
SuggesterParams.SUGGEST_COUNT, "2"),
"//str[@name='command'][.='reloadAll']"
);
assertQ(req("qt", rh,
SuggesterParams.SUGGEST_RELOAD_ALL, "true"),
"//str[@name='command'][.='reloadAll']"
);
}
示例8: doTest
import org.apache.solr.spelling.suggest.SuggesterParams; //导入依赖的package包/类
@Override
public void doTest() throws Exception {
del("*:*");
index(id, "1", "cat", "This is another title", "price", "10", "weight", "10");
index(id, "2", "cat", "Yet another", "price", "15", "weight", "10");
index(id, "3", "cat", "Yet another title", "price", "20", "weight", "20");
index(id, "4", "cat", "suggestions for suggest", "price", "25", "weight", "20");
index(id, "5", "cat", "Red fox", "price", "30", "weight", "20");
index(id, "6", "cat", "Rad fox", "price", "35", "weight", "30");
index(id, "7", "cat", "example data", "price", "40", "weight", "30");
index(id, "8", "cat", "example inputdata", "price", "45", "weight", "30");
index(id, "9", "cat", "blah in blah", "price", "50", "weight", "40");
index(id, "10", "cat", "another blah in blah", "price", "55", "weight", "40");
commit();
handle.clear();
handle.put("timestamp", SKIPVAL);
handle.put("maxScore", SKIPVAL);
handle.put("response", SKIP);
String requestHandlerName = "/suggest";
String docDictName = "suggest_fuzzy_doc_dict";
String docExprDictName = "suggest_fuzzy_doc_expr_dict";
//Shortcut names
String build = SuggesterParams.SUGGEST_BUILD;
String buildAll = SuggesterParams.SUGGEST_BUILD_ALL;
String count = SuggesterParams.SUGGEST_COUNT;
String dictionaryName = SuggesterParams.SUGGEST_DICT;
//Build the suggest dictionary
if (random().nextBoolean()) { // build all the suggesters in one go
query(buildRequest("", true, requestHandlerName, buildAll, "true"));
} else { // build suggesters individually
query(buildRequest("", true, requestHandlerName, build, "true", dictionaryName, docDictName));
query(buildRequest("", true, requestHandlerName, build, "true", dictionaryName, docExprDictName));
}
//Test Basic Functionality
query(buildRequest("exampel", false, requestHandlerName, dictionaryName, docDictName, count, "2"));
query(buildRequest("Yet", false, requestHandlerName, dictionaryName, docExprDictName, count, "2"));
query(buildRequest("blah", true, requestHandlerName, dictionaryName, docExprDictName, count, "2"));
query(buildRequest("blah", true, requestHandlerName, dictionaryName, docDictName, count, "2"));
//Test multiSuggester
query(buildRequest("exampel", false, requestHandlerName, dictionaryName, docDictName, dictionaryName, docExprDictName, count, "2"));
}