Java Code Examples for org.apache.solr.handler.component.ResponseBuilder#getQuery()

The following examples show how to use org.apache.solr.handler.component.ResponseBuilder#getQuery() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BasicResultContext.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
public BasicResultContext(ResponseBuilder rb) {
  this(rb.getResults().docList, rb.rsp.getReturnFields(), null, rb.getQuery(), rb.req);
}
 
Example 2
Source File: BasicResultContext.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
public BasicResultContext(ResponseBuilder rb, DocList docList) {
  this(docList, rb.rsp.getReturnFields(), null, rb.getQuery(), rb.req);
}
 
Example 3
Source File: StatsCache.java    From lucene-solr with Apache License 2.0 3 votes vote down vote up
/**
 * Check if the <code>statsSource</code> is missing some term or field statistics info,
 * which then needs to be retrieved.
 * <p>NOTE: this uses the local IndexReader for query rewriting, which may expand to less (or different)
 * terms as rewriting the same query on other shards' readers. This in turn may falsely fail to inform the consumers
 * about possibly missing stats, which may lead consumers to skip the fetching of full stats. Consequently
 * this would lead to incorrect global IDF data for the missing terms (because for these terms only local stats
 * would be used).</p>
 * @param rb request to evaluate against the statsSource
 * @param statsSource stats source to check
 * @param missingTermStats consumer of missing term stats
 * @param missingFieldStats consumer of missing field stats
 * @return approximate number of missing term stats and field stats combined
 */
public int approxCheckMissingStats(ResponseBuilder rb, StatsSource statsSource, Consumer<Term> missingTermStats, Consumer<String> missingFieldStats) throws IOException {
  CheckingIndexSearcher checkingSearcher = new CheckingIndexSearcher(statsSource, rb.req.getSearcher().getIndexReader(), missingTermStats, missingFieldStats);
  Query q = rb.getQuery();
  q = checkingSearcher.rewrite(q);
  checkingSearcher.createWeight(q, ScoreMode.COMPLETE, 1);
  return checkingSearcher.missingFieldsCount + checkingSearcher.missingTermsCount;
}