public void addOrUpdate(ScoreTerm scoreTerm) { if (this.size() < limit) { // there is still space in the queue this.add(scoreTerm); } else { // otherwise update the smallest in the queue in place and update the queue ScoreTerm scoreTermTop = this.top(); if (scoreTermTop.score < scoreTerm.score) { scoreTermTop.update(scoreTerm.field, scoreTerm.word, scoreTerm.score); this.updateTop(); } } } }
public static MultiTermVectorsItemResponse readItemResponse(StreamInput in) throws IOException { MultiTermVectorsItemResponse response = new MultiTermVectorsItemResponse(); response.readFrom(in); return response; }
/** * Sets whether term vectors are generated real-time. */ public TermVectorsRequestBuilder setRealtime(boolean realtime) { request.realtime(realtime); return this; }
/** * Return the start and stop offsets for each term if they were stored or * skip offsets. */ public TermVectorsRequest offsets(boolean offsets) { setFlag(Flag.Offsets, offsets); return this; }
/** * Sets the routing. Required if routing isn't id based. */ public TermVectorsRequestBuilder setRouting(String routing) { request.routing(routing); return this; }
/** * Sets the parent id of this document. Will simply set the routing to this value, as it is only * used for routing with delete requests. */ public TermVectorsRequestBuilder setParent(String parent) { request.parent(parent); return this; }
/** * Sets whether to return the field statistics for each term in the shard or skip. */ public TermVectorsRequestBuilder setFieldStatistics(boolean fieldStatistics) { request.fieldStatistics(fieldStatistics); return this; }
/** * Sets the settings for filtering out terms. */ public TermVectorsRequestBuilder setFilterSettings(TermVectorsRequest.FilterSettings filterSettings) { request.filterSettings(filterSettings); return this; } }
@Override public int advance(int target) throws IOException { while (nextDoc() < target && doc != NO_MORE_DOCS) { } return doc; }
@Override public MultiTermVectorsRequestBuilder newRequestBuilder(ElasticsearchClient client) { return new MultiTermVectorsRequestBuilder(client, this); } }
@Override public TermVectorsRequestBuilder newRequestBuilder(ElasticsearchClient client) { return new TermVectorsRequestBuilder(client, this); } }
/** * Sets the index where the document is located. */ public TermVectorsRequestBuilder setIndex(String index) { request.index(index); return this; }
/** * Sets whether to return the term statistics for each term in the shard or skip. */ public TermVectorsRequestBuilder setTermStatistics(boolean termStatistics) { request.termStatistics(termStatistics); return this; }
/** * Sets the id of the document. */ public TermVectorsRequestBuilder setId(String id) { request.id(id); return this; }
/** * Sets whether to return the payloads for each term or skip. */ public TermVectorsRequestBuilder setPayloads(boolean payloads) { request.payloads(payloads); return this; }
@Override public MultiTermVectorsRequest realtime(boolean realtime) { for (TermVectorsRequest request : requests) { request.realtime(realtime); } return this; } }
/** * Return the payloads for each term or skip. */ public TermVectorsRequest payloads(boolean payloads) { setFlag(Flag.Payloads, payloads); return this; }