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

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

本文整理了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

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

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

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

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

private String dump(String profileName,String dir,String parameters) {
  // Import profiles
  if (dir.isEmpty())
    dir = ".";
  File dirInAppPackage = new File(dir, "search/query-profiles");
  if (dirInAppPackage.exists())
    dir = dirInAppPackage.getPath();
  QueryProfileXMLReader reader = new QueryProfileXMLReader();
  QueryProfileRegistry registry = reader.read(dir);
  registry.freeze();
  // Dump (through query to get wiring & parameter parsing done easily)
  Query query = new Query("?" + parameters, registry.compile().findQueryProfile(profileName));
  Map<String,Object> properties = query.properties().listProperties();
  // Create result
  StringBuilder b = new StringBuilder();
  for (Map.Entry<String,Object> property : properties.entrySet()) {
    b.append(property.getKey());
    b.append("=");
    b.append(property.getValue().toString());
    b.append("\n");
  }
  return b.toString();
}

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

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

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

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

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

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

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

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

相关文章

微信公众号

最新文章

更多