@Override SortedSetDocValues getValues(LeafReader reader, String field) throws IOException { return DocValues.singleton(DocValues.getSorted(reader, field)); } };
/** Wraps a {@link SortedSetDocValues} as a single-valued view if the field is an instance of {@link SortedSetSortField}, * returns {@link SortedDocValues} for the field otherwise. */ static SortedDocValues getOrWrapSorted(LeafReader reader, SortField sortField) throws IOException { if (sortField instanceof SortedSetSortField) { SortedSetSortField sf = (SortedSetSortField) sortField; return SortedSetSelector.wrap(DocValues.getSortedSet(reader, sf.getField()), sf.getSelector()); } else { return DocValues.getSorted(reader, sortField.getField()); } }
/** Retrieves the SortedDocValues for the field in this segment */ protected SortedDocValues getSortedDocValues(LeafReaderContext context, String field) throws IOException { return DocValues.getSorted(context.reader(), field); }
values = DocValues.getSorted(reader, field); break;
@Override public SortedDocValues getOrdinalsValues(String type) { try { return DocValues.getSorted(reader, ParentFieldMapper.joinField(type)); } catch (IOException e) { throw new IllegalStateException("cannot load join doc values field for type [" + type + "]", e); } }
/** Wraps a {@link SortedSetDocValues} as a single-valued view if the field is an instance of {@link SortedSetSortField}, * returns {@link SortedDocValues} for the field otherwise. */ static SortedDocValues getOrWrapSorted(LeafReader reader, SortField sortField) throws IOException { if (sortField instanceof SortedSetSortField) { SortedSetSortField sf = (SortedSetSortField) sortField; return SortedSetSelector.wrap(DocValues.getSortedSet(reader, sf.getField()), sf.getSelector()); } else { return DocValues.getSorted(reader, sortField.getField()); } }
@Override SortedSetDocValues getValues(LeafReader reader, String field) throws IOException { return DocValues.singleton(DocValues.getSorted(reader, field)); } };
/** Retrieves the SortedDocValues for the field in this segment */ protected SortedDocValues getSortedDocValues(LeafReaderContext context, String field) throws IOException { return DocValues.getSorted(context.reader(), field); }
/** Retrieves the SortedDocValues for the field in this segment */ protected SortedDocValues getSortedDocValues(LeafReaderContext context, String field) throws IOException { return DocValues.getSorted(context.reader(), field); }
/** Retrieves the SortedDocValues for the field in this segment */ protected SortedDocValues getSortedDocValues(LeafReaderContext context, String field) throws IOException { return DocValues.getSorted(context.reader(), field); }
@Override protected void doSetNextReader(LeafReaderContext context) throws IOException { this.readerContext = context; groupIndex = DocValues.getSorted(context.reader(), groupField); for (GroupHead groupHead : groups.values()) { for (int i = 0; i < groupHead.comparators.length; i++) { groupHead.leafComparators[i] = groupHead.comparators[i].getLeafComparator(context); } } }
static SortedDocValues open(LeafReaderContext context, String field) throws IOException { try { return DocValues.getSorted(context.reader(), field); } catch (RuntimeException e) { throw new DocTermsIndexException(field, e); } }
static SortedDocValues open(LeafReaderContext context, String field) throws IOException { try { return DocValues.getSorted(context.reader(), field); } catch (RuntimeException e) { throw new DocTermsIndexException(field, e); } }
static SortedDocValues open(LeafReaderContext context, String field) throws IOException { try { return DocValues.getSorted(context.reader(), field); } catch (RuntimeException e) { throw new DocTermsIndexException(field, e); } }
@Override protected void doSetNextReader(LeafReaderContext readerContext) throws IOException { super.doSetNextReader(readerContext); index = DocValues.getSorted(readerContext.reader(), groupField); }
@Override public void setNextReader(LeafReaderContext readerContext) throws IOException { this.docValues = DocValues.getSorted(readerContext.reader(), field); this.ordsToGroupIds.clear(); BytesRef scratch = new BytesRef(); for (int i = 0; i < values.size(); i++) { values.get(i, scratch); int ord = this.docValues.lookupTerm(scratch); if (ord >= 0) ordsToGroupIds.put(ord, i); } }
@Override public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException { SortedDocValues docTermOrds = DocValues.getSorted(context.reader(), field); if (ordinalMap != null) { LongValues segmentOrdToGlobalOrdLookup = ordinalMap.getGlobalOrds(context.ord); return new OrdinalMapCollector(docTermOrds, segmentOrdToGlobalOrdLookup); } else { return new SegmentOrdinalCollector(docTermOrds); } }
@Override public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException { SortedDocValues docTermOrds = DocValues.getSorted(context.reader(), field); if (ordinalMap != null) { LongValues segmentOrdToGlobalOrdLookup = ordinalMap.getGlobalOrds(context.ord); return new OrdinalMapCollector(docTermOrds, segmentOrdToGlobalOrdLookup); } else { return new SegmentOrdinalCollector(docTermOrds); } }
@Override protected void doSetNextReader(LeafReaderContext readerContext) throws IOException { super.doSetNextReader(readerContext); index = DocValues.getSorted(readerContext.reader(), groupField); // Rebuild ordSet ordSet.clear(); for (SearchGroupDocs<BytesRef> group : groupMap.values()) { // System.out.println(" group=" + (group.groupValue == null ? "null" : group.groupValue.utf8ToString())); int ord = group.groupValue == null ? -1 : index.lookupTerm(group.groupValue); if (group.groupValue == null || ord >= 0) { groupDocs[ordSet.put(ord)] = group; } } }
@Override public Scorer scorer(LeafReaderContext context) throws IOException { SortedDocValues values = DocValues.getSorted(context.reader(), joinField); if (values == null) { return null; } Scorer approximationScorer = approximationWeight.scorer(context); if (approximationScorer == null) { return null; } if (globalOrds != null) { return new OrdinalMapScorer(this, score(), foundOrds, values, approximationScorer.iterator(), globalOrds.getGlobalOrds(context.ord)); } { return new SegmentOrdinalScorer(this, score(), foundOrds, values, approximationScorer.iterator()); } }