List of usage examples for org.apache.lucene.index DocValues emptyNumeric
public static final NumericDocValues emptyNumeric()
From source file:org.apache.solr.uninverting.FieldCacheImpl.java
License:Apache License
@Override public NumericDocValues getNumerics(LeafReader reader, String field, Parser parser) throws IOException { if (parser == null) { throw new NullPointerException(); }//from w w w . j a v a 2 s . c om final NumericDocValues valuesIn = reader.getNumericDocValues(field); if (valuesIn != null) { return valuesIn; } else { final FieldInfo info = reader.getFieldInfos().fieldInfo(field); if (info == null) { return DocValues.emptyNumeric(); } else if (info.getDocValuesType() != DocValuesType.NONE) { throw new IllegalStateException( "Type mismatch: " + field + " was indexed as " + info.getDocValuesType()); } if (parser instanceof PointParser) { // points case // no points in this segment if (info.getPointDimensionCount() == 0) { return DocValues.emptyNumeric(); } if (info.getPointDimensionCount() != 1) { throw new IllegalStateException("Type mismatch: " + field + " was indexed with dimensions=" + info.getPointDimensionCount()); } PointValues values = reader.getPointValues(field); // no actual points for this field (e.g. all points deleted) if (values == null || values.size() == 0) { return DocValues.emptyNumeric(); } // not single-valued if (values.size() != values.getDocCount()) { throw new IllegalStateException( "Type mismatch: " + field + " was indexed with multiple values, numValues=" + values.size() + ",numDocs=" + values.getDocCount()); } } else { // postings case // not indexed if (info.getIndexOptions() == IndexOptions.NONE) { return DocValues.emptyNumeric(); } } return ((LongsFromArray) caches.get(Long.TYPE).get(reader, new CacheKey(field, parser))).iterator(); } }
From source file:org.meresco.lucene.search.DeDupFilterSuperCollector.java
License:Open Source License
@Override public void setNextReader(AtomicReaderContext context) throws IOException { this.context = context; this.delegate.setNextReader(context); this.currentDocBase = context.docBase; NumericDocValues kv = context.reader().getNumericDocValues(this.keyName); if (kv == null) kv = DocValues.emptyNumeric(); this.keyValues = kv; NumericDocValues sbv = null;/*from www . j a va 2 s . c o m*/ if (this.sortByFieldName != null) sbv = context.reader().getNumericDocValues(this.sortByFieldName); if (sbv == null) sbv = DocValues.emptyNumeric(); this.sortByValues = sbv; this.delegate.setNextReader(context); }
From source file:org.meresco.lucene.search.GroupSuperCollector.java
License:Open Source License
@Override public void setNextReader(AtomicReaderContext context) throws IOException { if (this.keyToDocIds == null) { float loadFactor = 0.75f; int maxDoc = (int) (ReaderUtil.getTopLevelContext(context).reader().maxDoc() * (1 + (1 - loadFactor))); this.keyToDocIds = new TLongObjectHashMap<int[]>(maxDoc / this.groupSuperCollector.subs.size() / 10, loadFactor);/* ww w . j a v a2s . c om*/ this.keyToDocId = new TLongIntHashMap(maxDoc / this.groupSuperCollector.subs.size(), loadFactor, NO_ENTRY_KEY, NO_ENTRY_VALUE); } this.context = context; this.delegate.setNextReader(context); NumericDocValues kv = context.reader().getNumericDocValues(this.keyName); if (kv == null) kv = DocValues.emptyNumeric(); this.keyValues = kv; this.delegate.setNextReader(context); }
From source file:org.neo4j.kernel.api.impl.index.IndexReaderStub.java
License:Open Source License
public IndexReaderStub(final Map<String, NumericDocValues> ndvs) { this.ndvs = s -> { NumericDocValues dv = ndvs.get(s); if (dv == null) { return DocValues.emptyNumeric(); }//from w w w . j a v a2 s. c o m return dv; }; }
From source file:org.neo4j.kernel.api.impl.index.IndexReaderStub.java
License:Open Source License
@Override public NumericDocValues getNormValues(String field) throws IOException { return DocValues.emptyNumeric(); }