com.yahoo.search.Query.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(290)

本文整理了Java中com.yahoo.search.Query.<init>方法的一些代码示例,展示了Query.<init>的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.<init>方法的具体详情如下:
包路径:com.yahoo.search.Query
类名称:Query
方法名:<init>

Query.<init>介绍

[英]Constructs an empty (null) query
[中]构造一个空(null)查询

代码示例

代码示例来源:origin: com.yahoo.vespa/container-search

  1. /**
  2. * Creates a new query from another query, but with time sensitive fields reset.
  3. */
  4. public static Query createNewQuery(Query query) {
  5. return new Query(query, System.currentTimeMillis());
  6. }

代码示例来源:origin: com.yahoo.vespa/container-search

  1. for (Iterator<String> iter = queries.iterator(); iter.hasNext(); ){
  2. String queryString = iter.next();
  3. Query query = new Query("?query="+queryString);
  4. ruleBase.analyze(query,0);

代码示例来源:origin: com.yahoo.vespa/container-search

  1. private String dump(String profileName,String dir,String parameters) {
  2. // Import profiles
  3. if (dir.isEmpty())
  4. dir = ".";
  5. File dirInAppPackage = new File(dir, "search/query-profiles");
  6. if (dirInAppPackage.exists())
  7. dir = dirInAppPackage.getPath();
  8. QueryProfileXMLReader reader = new QueryProfileXMLReader();
  9. QueryProfileRegistry registry = reader.read(dir);
  10. registry.freeze();
  11. // Dump (through query to get wiring & parameter parsing done easily)
  12. Query query = new Query("?" + parameters, registry.compile().findQueryProfile(profileName));
  13. Map<String,Object> properties = query.properties().listProperties();
  14. // Create result
  15. StringBuilder b = new StringBuilder();
  16. for (Map.Entry<String,Object> property : properties.entrySet()) {
  17. b.append(property.getKey());
  18. b.append("=");
  19. b.append(property.getValue().toString());
  20. b.append("\n");
  21. }
  22. return b.toString();
  23. }

代码示例来源:origin: com.yahoo.vespa/container-search

  1. @SuppressWarnings("unchecked")
  2. private HttpResponse errorResponse(HttpRequest request, ErrorMessage errorMessage) {
  3. Query query = new Query();
  4. Result result = new Result(query, errorMessage);
  5. Renderer renderer = getRendererCopy(ComponentSpecification.fromString(request.getProperty("format")));
  6. return new HttpSearchResponse(getHttpResponseStatus(request, result), result, query, renderer);
  7. }

代码示例来源:origin: vespa-engine/sample-apps

  1. private Hit retrieveUserProfile(String userId, Execution execution) {
  2. Query query = new Query();
  3. query.getModel().setRestrict("user");
  4. query.getModel().getQueryTree().setRoot(new WordItem(userId, "user_id"));
  5. query.setHits(1);
  6. SearchChain vespaChain = execution.searchChainRegistry().getComponent("vespa");
  7. Result result = new Execution(vespaChain, execution.context()).search(query);
  8. execution.fill(result); // This is needed to get the actual summary data
  9. Iterator<Hit> hiterator = result.hits().deepIterator();
  10. return hiterator.hasNext() ? hiterator.next() : null;
  11. }

代码示例来源:origin: com.yahoo.vespa/container-search

  1. private void addDefaultResults() {
  2. Query q = new Query("?query=default");
  3. Result r = new Result(q);
  4. r.hits().add(new Hit("http://default-1.html", 0));
  5. r.hits().add(new Hit("http://default-2.html", 0));
  6. r.hits().add(new Hit("http://default-3.html", 0));
  7. r.hits().add(new Hit("http://default-4.html", 0));
  8. defaultFilledResult = r;
  9. addResult(q, r);
  10. }

代码示例来源:origin: com.yahoo.vespa/container-search

  1. CompiledQueryProfile queryProfile = queryProfileRegistry.findQueryProfile(queryProfileName);
  2. Query query = new Query(request, requestMap, queryProfile);

相关文章