public SimpleFieldCollector(Sort sort, FieldValueHitQueue<Entry> queue, int numHits, boolean fillFields, boolean trackDocScores, boolean trackMaxScore, boolean trackTotalHits) { super(queue, numHits, fillFields, sort.needsScores() || trackDocScores || trackMaxScore); this.sort = sort; this.queue = queue; if (trackMaxScore) { maxScore = Float.NEGATIVE_INFINITY; // otherwise we would keep NaN } this.trackDocScores = trackDocScores; this.trackMaxScore = trackMaxScore; // If one of the sort fields needs scores, and if we also track scores, then // we might call scorer.score() several times per doc so wrapping the scorer // to cache scores would help this.mayNeedScoresTwice = sort.needsScores() && (trackDocScores || trackMaxScore); this.trackTotalHits = trackTotalHits; }
/** Creates a new Sorter to sort the index with {@code sort} */ Sorter(Sort sort) { if (sort.needsScores()) { throw new IllegalArgumentException("Cannot sort an index with a Sort that refers to the relevance score"); } this.sort = sort; }
public PagingFieldCollector(Sort sort, FieldValueHitQueue<Entry> queue, FieldDoc after, int numHits, boolean fillFields, boolean trackDocScores, boolean trackMaxScore, boolean trackTotalHits) { super(queue, numHits, fillFields, trackDocScores || trackMaxScore || sort.needsScores()); this.sort = sort; this.queue = queue; this.trackDocScores = trackDocScores; this.trackMaxScore = trackMaxScore; this.after = after; this.mayNeedScoresTwice = sort.needsScores() && (trackDocScores || trackMaxScore); this.trackTotalHits = trackTotalHits; // Must set maxScore to NEG_INF, or otherwise Math.max always returns NaN. if (trackMaxScore) { maxScore = Float.NEGATIVE_INFINITY; } FieldComparator<?>[] comparators = queue.comparators; // Tell all comparators their top value: for(int i=0;i<comparators.length;i++) { @SuppressWarnings("unchecked") FieldComparator<Object> comparator = (FieldComparator<Object>) comparators[i]; comparator.setTopValue(after.fields[i]); } }
@Override public boolean needsScores() { SortAndFormats sort = subSearchContext.sort(); if (sort != null) { return sort.sort.needsScores() || subSearchContext.trackScores(); } else { // sort by score return true; } }
protected Weight createInnerHitQueryWeight() throws IOException { final boolean needsScores = size() != 0 && (sort() == null || sort().sort.needsScores()); return context.searcher().createNormalizedWeight(query(), needsScores); }
@Override public boolean needsScores() { return sortWithinGroup.needsScores(); } }
@Override public boolean needsScores() { return sort.needsScores(); }
public SimpleFieldCollector(Sort sort, FieldValueHitQueue<Entry> queue, int numHits, boolean fillFields, boolean trackDocScores, boolean trackMaxScore) { super(queue, numHits, fillFields, sort.needsScores() || trackDocScores || trackMaxScore); this.queue = queue; if (trackMaxScore) { maxScore = Float.NEGATIVE_INFINITY; // otherwise we would keep NaN } this.trackDocScores = trackDocScores; this.trackMaxScore = trackMaxScore; // If one of the sort fields needs scores, and if we also track scores, then // we might call scorer.score() several times per doc so wrapping the scorer // to cache scores would help this.mayNeedScoresTwice = sort.needsScores() && (trackDocScores || trackMaxScore); }
/** Creates a new Sorter to sort the index with {@code sort} */ Sorter(Sort sort) { if (sort.needsScores()) { throw new IllegalArgumentException("Cannot sort an index with a Sort that refers to the relevance score"); } this.sort = sort; }
/** Creates a new Sorter to sort the index with {@code sort} */ Sorter(Sort sort) { if (sort.needsScores()) { throw new IllegalArgumentException("Cannot sort an index with a Sort that refers to the relevance score"); } this.sort = sort; }
/** Creates a new Sorter to sort the index with {@code sort} */ Sorter(Sort sort) { if (sort.needsScores()) { throw new IllegalArgumentException("Cannot sort an index with a Sort that refers to the relevance score"); } this.sort = sort; }
public SearchGroupDocs(GROUP_VALUE_TYPE groupValue, TopDocsCollector<?> collector) { this.groupValue = groupValue; this.collector = collector; } }
TopDocsReducer(Sort withinGroupSort, int maxDocsPerGroup, boolean getScores, boolean getMaxScores, boolean fillSortFields) { this.needsScores = getScores || getMaxScores || withinGroupSort.needsScores(); this.supplier = withinGroupSort == Sort.RELEVANCE ? () -> TopScoreDocCollector.create(maxDocsPerGroup) : () -> TopFieldCollector.create(withinGroupSort, maxDocsPerGroup, fillSortFields, getScores, getMaxScores, true); // TODO: disable exact counts? }
@Override public boolean needsScores() { Sort sort = subSearchContext.sort(); if (sort != null) { return sort.needsScores() || subSearchContext.trackScores(); } else { // sort by score return true; } }
@Override public boolean needsScores() { SortAndFormats sort = subSearchContext.sort(); if (sort != null) { return sort.sort.needsScores() || subSearchContext.trackScores(); } else { // sort by score return true; } }
@Override public boolean needsScores() { SortAndFormats sort = subSearchContext.sort(); if (sort != null) { return sort.sort.needsScores() || subSearchContext.trackScores(); } else { // sort by score return true; } }
@Override public boolean needsScores() { SortAndFormats sort = subSearchContext.sort(); if (sort != null) { return sort.sort.needsScores() || subSearchContext.trackScores(); } else { // sort by score return true; } }
protected Weight createInnerHitQueryWeight() throws IOException { final boolean needsScores = size() != 0 && (sort() == null || sort().sort.needsScores()); return context.searcher().createNormalizedWeight(query(), needsScores); }
protected Weight createInnerHitQueryWeight() throws IOException { final boolean needsScores = size() != 0 && (sort() == null || sort().sort.needsScores()); return context.searcher().createNormalizedWeight(query(), needsScores); }
protected Weight createInnerHitQueryWeight() throws IOException { final boolean needsScores = size() != 0 && (sort() == null || sort().sort.needsScores()); return context.searcher().createNormalizedWeight(query(), needsScores); }