use of org.opensearch.search.RescoreDocIds in project OpenSearch by opensearch-project.
the class SearchContext method rescoreDocIds.
public final RescoreDocIds rescoreDocIds() {
final List<RescoreContext> rescore = rescore();
if (rescore == null) {
return RescoreDocIds.EMPTY;
}
Map<Integer, Set<Integer>> rescoreDocIds = null;
for (int i = 0; i < rescore.size(); i++) {
final Set<Integer> docIds = rescore.get(i).getRescoredDocs();
if (docIds != null && docIds.isEmpty() == false) {
if (rescoreDocIds == null) {
rescoreDocIds = new HashMap<>();
}
rescoreDocIds.put(i, docIds);
}
}
return rescoreDocIds == null ? RescoreDocIds.EMPTY : new RescoreDocIds(rescoreDocIds);
}
use of org.opensearch.search.RescoreDocIds in project OpenSearch by opensearch-project.
the class QuerySearchResult method readFromWithId.
public void readFromWithId(ShardSearchContextId id, StreamInput in) throws IOException {
this.contextId = id;
from = in.readVInt();
size = in.readVInt();
int numSortFieldsPlus1 = in.readVInt();
if (numSortFieldsPlus1 == 0) {
sortValueFormats = null;
} else {
sortValueFormats = new DocValueFormat[numSortFieldsPlus1 - 1];
for (int i = 0; i < sortValueFormats.length; ++i) {
sortValueFormats[i] = in.readNamedWriteable(DocValueFormat.class);
}
}
setTopDocs(readTopDocs(in));
if (in.getVersion().before(LegacyESVersion.V_7_7_0)) {
if (hasAggs = in.readBoolean()) {
aggregations = DelayableWriteable.referencing(InternalAggregations.readFrom(in));
}
if (in.getVersion().before(LegacyESVersion.V_7_2_0)) {
// The list of PipelineAggregators is sent by old versions. We don't need it anyway.
in.readNamedWriteableList(PipelineAggregator.class);
}
} else {
if (hasAggs = in.readBoolean()) {
aggregations = DelayableWriteable.delayed(InternalAggregations::readFrom, in);
}
}
if (in.readBoolean()) {
suggest = new Suggest(in);
}
searchTimedOut = in.readBoolean();
terminatedEarly = in.readOptionalBoolean();
profileShardResults = in.readOptionalWriteable(ProfileShardResult::new);
hasProfileResults = profileShardResults != null;
serviceTimeEWMA = in.readZLong();
nodeQueueSize = in.readInt();
if (in.getVersion().onOrAfter(LegacyESVersion.V_7_10_0)) {
setShardSearchRequest(in.readOptionalWriteable(ShardSearchRequest::new));
setRescoreDocIds(new RescoreDocIds(in));
}
}
Aggregations