當前位置: 首頁>>代碼示例>>Java>>正文


Java SuggesterParams類代碼示例

本文整理匯總了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']"
      );
}
 
開發者ID:europeana,項目名稱:search,代碼行數:27,代碼來源:SuggestComponentTest.java

示例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']"
      );
}
 
開發者ID:europeana,項目名稱:search,代碼行數:21,代碼來源:SuggestComponentTest.java

示例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
      );
}
 
開發者ID:europeana,項目名稱:search,代碼行數:20,代碼來源:SuggestComponentTest.java

示例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']"
      );
}
 
開發者ID:europeana,項目名稱:search,代碼行數:15,代碼來源:SuggestComponentTest.java

示例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']"
      );
}
 
開發者ID:europeana,項目名稱:search,代碼行數:15,代碼來源:SuggestComponentTest.java

示例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']"
      );
}
 
開發者ID:europeana,項目名稱:search,代碼行數:15,代碼來源:SuggestComponentTest.java

示例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']"
      );
}
 
開發者ID:europeana,項目名稱:search,代碼行數:15,代碼來源:SuggestComponentTest.java

示例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"));
  
}
 
開發者ID:europeana,項目名稱:search,代碼行數:49,代碼來源:DistributedSuggestComponentTest.java


注:本文中的org.apache.solr.spelling.suggest.SuggesterParams類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。