org.elasticsearch.search.internal.InternalSearchHits Java Examples

The following examples show how to use org.elasticsearch.search.internal.InternalSearchHits. 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: InternalTopHits.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
public InternalTopHits(String name, int from, int size, TopDocs topDocs, InternalSearchHits searchHits,
        List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) {
    super(name, pipelineAggregators, metaData);
    this.from = from;
    this.size = size;
    this.topDocs = topDocs;
    this.searchHits = searchHits;
}
 
Example #2
Source File: ProcessSynchronizer.java    From elasticsearch-reindex-tool with Apache License 2.0 5 votes vote down vote up
public SearchHits pollDataToIndexed() throws InterruptedException {
  SearchHits polled = dataQueue.poll(queuePollTimeout, TimeUnit.SECONDS);
  if (didTimeout(polled)) {
    return InternalSearchHits.empty();
  }
  return polled;
}
 
Example #3
Source File: ElasticSearchService.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
public SearchResponse search(String searchTerms, List<String> references, List<String> siteIds, int start, int end, Map<String,String> additionalSearchInfromation) {
    return new SearchResponse(
            new InternalSearchResponse(new InternalSearchHits(new InternalSearchHit[0], 0, 0.0f), new InternalFacets(Collections.EMPTY_LIST), new InternalAggregations(Collections.EMPTY_LIST), new Suggest(), false, false),
            "no-op",
            1,
            1,
            1,
            new ShardSearchFailure[0]
    );
}
 
Example #4
Source File: ElasticSearchService.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
public SearchResponse search(String searchTerms, List<String> references, List<String> siteIds, int start, int end, Map<String,String> additionalSearchInfromation) {
    return new SearchResponse(
            new InternalSearchResponse(new InternalSearchHits(new InternalSearchHit[0], 0, 0.0f), new InternalFacets(Collections.EMPTY_LIST), new InternalAggregations(Collections.EMPTY_LIST), new Suggest(), false, false),
            "no-op",
            1,
            1,
            1,
            new ShardSearchFailure[0]
    );
}
 
Example #5
Source File: HttpSearchAction.java    From elasticsearch-helper with Apache License 2.0 5 votes vote down vote up
private InternalSearchResponse parseInternalSearchResponse(Map<String,?> map) {
    InternalSearchHits internalSearchHits = parseInternalSearchHits(map);
    InternalAggregations internalAggregations = parseInternalAggregations(map);
    Suggest suggest = parseSuggest(map);
    InternalProfileShardResults internalProfileShardResults = null;
    Boolean timeout = false;
    Boolean terminatedEarly = false;
    return new InternalSearchResponse(internalSearchHits,
            internalAggregations,
            suggest,
            internalProfileShardResults,
            timeout,
            terminatedEarly);
}
 
Example #6
Source File: HttpSearchAction.java    From elasticsearch-helper with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private InternalSearchHits parseInternalSearchHits(Map<String,?> map) {
    // InternalSearchHits(InternalSearchHit[] hits, long totalHits, float maxScore)
    InternalSearchHit[] internalSearchHits = parseInternalSearchHit(map);
    map = (Map<String, ?>) map.get(HITS);
    long totalHits = map.containsKey(TOTAL) ? (Integer)map.get(TOTAL) : -1L;
    double maxScore = map.containsKey(MAXSCORE) ? (Double)map.get(MAXSCORE) : 0.0f;
    return new InternalSearchHits(internalSearchHits, totalHits, (float)maxScore);
}
 
Example #7
Source File: FetchSearchResult.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public InternalSearchHits hits() {
    return hits;
}
 
Example #8
Source File: FetchSearchResult.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    id = in.readLong();
    hits = InternalSearchHits.readSearchHits(in, InternalSearchHits.streamContext().streamShardTarget(StreamContext.ShardTargetType.NO_STREAM));
}
 
Example #9
Source File: FetchSearchResult.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeLong(id);
    hits.writeTo(out, InternalSearchHits.streamContext().streamShardTarget(StreamContext.ShardTargetType.NO_STREAM));
}