List of usage examples for org.apache.lucene.index DocValues emptySortedNumeric
public static final SortedNumericDocValues emptySortedNumeric(int maxDoc)
From source file:org.codelibs.elasticsearch.search.MultiValueMode.java
License:Apache License
/** * Return a {NumericDocValues} instance that can be used to sort root documents * with this mode, the provided values and filters for root/inner documents. * * For every root document, the values of its inner documents will be aggregated. * If none of the inner documents has a value, then <code>missingValue</code> is returned. * * Allowed Modes: SUM, AVG, MIN, MAX/*from w ww . j ava 2 s . c o m*/ * * NOTE: Calling the returned instance on docs that are not root docs is illegal * The returned instance can only be evaluate the current and upcoming docs */ public NumericDocValues select(final SortedNumericDocValues values, final long missingValue, final BitSet rootDocs, final DocIdSetIterator innerDocs, int maxDoc) throws IOException { if (rootDocs == null || innerDocs == null) { return select(DocValues.emptySortedNumeric(maxDoc), missingValue); } return new NumericDocValues() { int lastSeenRootDoc = 0; long lastEmittedValue = missingValue; @Override public long get(int rootDoc) { assert rootDocs.get(rootDoc) : "can only sort root documents"; assert rootDoc >= lastSeenRootDoc : "can only evaluate current and upcoming root docs"; if (rootDoc == lastSeenRootDoc) { return lastEmittedValue; } try { final int prevRootDoc = rootDocs.prevSetBit(rootDoc - 1); final int firstNestedDoc; if (innerDocs.docID() > prevRootDoc) { firstNestedDoc = innerDocs.docID(); } else { firstNestedDoc = innerDocs.advance(prevRootDoc + 1); } lastSeenRootDoc = rootDoc; lastEmittedValue = pick(values, missingValue, innerDocs, firstNestedDoc, rootDoc); return lastEmittedValue; } catch (IOException e) { throw new RuntimeException(e); } } }; }
From source file:org.elasticsearch.index.fielddata.plain.AtomicLongFieldData.java
License:Apache License
public static AtomicNumericFieldData empty(final int maxDoc) { return new AtomicLongFieldData(0) { @Override/*from w ww. ja va 2s. c o m*/ public SortedNumericDocValues getLongValues() { return DocValues.emptySortedNumeric(maxDoc); } @Override public Collection<Accountable> getChildResources() { return Collections.emptyList(); } }; }
From source file:org.neo4j.kernel.api.impl.index.IndexReaderStub.java
License:Open Source License
@Override public SortedNumericDocValues getSortedNumericDocValues(String field) throws IOException { return DocValues.emptySortedNumeric(elements.length); }