Java 类org.apache.lucene.index.DocValues 实例源码

项目:elasticsearch_my    文件:DocValuesSliceQuery.java   
@Override
public Weight createWeight(IndexSearcher searcher, boolean needsScores) throws IOException {
    return new RandomAccessWeight(this) {
        @Override
        protected Bits getMatchingDocs(final LeafReaderContext context) throws IOException {
            final SortedNumericDocValues values = DocValues.getSortedNumeric(context.reader(), getField());
            return new Bits() {
                @Override
                public boolean get(int doc) {
                    values.setDocument(doc);
                    for (int i = 0; i < values.count(); i++) {
                        return contains(BitMixer.mix(values.valueAt(i)));
                    }
                    return contains(0);
                }

                @Override
                public int length() {
                    return context.reader().maxDoc();
                }
            };
        }
    };
}
项目:elasticsearch_my    文件:IndexIndexFieldData.java   
@Override
public RandomAccessOrds getOrdinalsValues() {
    final BytesRef term = new BytesRef(index);
    final SortedDocValues sortedValues = new SortedDocValues() {

        @Override
        public BytesRef lookupOrd(int ord) {
            return term;
        }

        @Override
        public int getValueCount() {
            return 1;
        }

        @Override
        public int getOrd(int docID) {
            return 0;
        }
    };
    return (RandomAccessOrds) DocValues.singleton(sortedValues);
}
项目:elasticsearch_my    文件:AbstractAtomicOrdinalsFieldData.java   
public static AtomicOrdinalsFieldData empty() {
    return new AbstractAtomicOrdinalsFieldData(DEFAULT_SCRIPT_FUNCTION) {

        @Override
        public long ramBytesUsed() {
            return 0;
        }

        @Override
        public Collection<Accountable> getChildResources() {
            return Collections.emptyList();
        }

        @Override
        public void close() {
        }

        @Override
        public RandomAccessOrds getOrdinalsValues() {
            return DocValues.emptySortedSet();
        }
    };
}
项目:elasticsearch_my    文件:MultiValueModeTests.java   
public void testSingleValuedLongs() throws Exception {
    final int numDocs = scaledRandomIntBetween(1, 100);
    final long[] array = new long[numDocs];
    final FixedBitSet docsWithValue = randomBoolean() ? null : new FixedBitSet(numDocs);
    for (int i = 0; i < array.length; ++i) {
        if (randomBoolean()) {
            array[i] = randomLong();
            if (docsWithValue != null) {
                docsWithValue.set(i);
            }
        } else if (docsWithValue != null && randomBoolean()) {
            docsWithValue.set(i);
        }
    }
    final NumericDocValues singleValues = new NumericDocValues() {
        @Override
        public long get(int docID) {
            return array[docID];
        }
    };
    final SortedNumericDocValues multiValues = DocValues.singleton(singleValues, docsWithValue);
    verify(multiValues, numDocs);
    final FixedBitSet rootDocs = randomRootDocs(numDocs);
    final FixedBitSet innerDocs = randomInnerDocs(rootDocs);
    verify(multiValues, numDocs, rootDocs, innerDocs);
}
项目:elasticsearch_my    文件:SingleOrdinalsTests.java   
public void testSvValues() throws IOException {
    int numDocs = 1000000;
    int numOrdinals = numDocs / 4;
    Map<Integer, Long> controlDocToOrdinal = new HashMap<>();
    OrdinalsBuilder builder = new OrdinalsBuilder(numDocs);
    long ordinal = builder.currentOrdinal();
    for (int doc = 0; doc < numDocs; doc++) {
        if (doc % numOrdinals == 0) {
            ordinal = builder.nextOrdinal();
        }
        controlDocToOrdinal.put(doc, ordinal);
        builder.addDoc(doc);
    }

    Ordinals ords = builder.build();
    assertThat(ords, instanceOf(SinglePackedOrdinals.class));
    RandomAccessOrds docs = ords.ordinals();
    final SortedDocValues singleOrds = DocValues.unwrapSingleton(docs);
    assertNotNull(singleOrds);

    for (Map.Entry<Integer, Long> entry : controlDocToOrdinal.entrySet()) {
        assertThat(entry.getValue(), equalTo((long) singleOrds.getOrd(entry.getKey())));
    }
}
项目:lams    文件:Lucene45DocValuesProducer.java   
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
  switch(field.getDocValuesType()) {
    case SORTED_SET:
      return DocValues.docsWithValue(getSortedSet(field), maxDoc);
    case SORTED:
      return DocValues.docsWithValue(getSorted(field), maxDoc);
    case BINARY:
      BinaryEntry be = binaries.get(field.number);
      return getMissingBits(be.missingOffset);
    case NUMERIC:
      NumericEntry ne = numerics.get(field.number);
      return getMissingBits(ne.missingOffset);
    default:
      throw new AssertionError();
  }
}
项目:lams    文件:Lucene49DocValuesProducer.java   
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
  switch(field.getDocValuesType()) {
    case SORTED_SET:
      return DocValues.docsWithValue(getSortedSet(field), maxDoc);
    case SORTED_NUMERIC:
      return DocValues.docsWithValue(getSortedNumeric(field), maxDoc);
    case SORTED:
      return DocValues.docsWithValue(getSorted(field), maxDoc);
    case BINARY:
      BinaryEntry be = binaries.get(field.number);
      return getMissingBits(be.missingOffset);
    case NUMERIC:
      NumericEntry ne = numerics.get(field.number);
      return getMissingBits(ne.missingOffset);
    default:
      throw new AssertionError();
  }
}
项目:lams    文件:Lucene410DocValuesProducer.java   
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
  switch(field.getDocValuesType()) {
    case SORTED_SET:
      return DocValues.docsWithValue(getSortedSet(field), maxDoc);
    case SORTED_NUMERIC:
      return DocValues.docsWithValue(getSortedNumeric(field), maxDoc);
    case SORTED:
      return DocValues.docsWithValue(getSorted(field), maxDoc);
    case BINARY:
      BinaryEntry be = binaries.get(field.number);
      return getMissingBits(be.missingOffset);
    case NUMERIC:
      NumericEntry ne = numerics.get(field.number);
      return getMissingBits(ne.missingOffset);
    default:
      throw new AssertionError();
  }
}
项目:lams    文件:FieldCacheImpl.java   
public SortedDocValues getTermsIndex(AtomicReader reader, String field, float acceptableOverheadRatio) throws IOException {
  SortedDocValues valuesIn = reader.getSortedDocValues(field);
  if (valuesIn != null) {
    // Not cached here by FieldCacheImpl (cached instead
    // per-thread by SegmentReader):
    return valuesIn;
  } else {
    final FieldInfo info = reader.getFieldInfos().fieldInfo(field);
    if (info == null) {
      return DocValues.emptySorted();
    } else if (info.hasDocValues()) {
      // we don't try to build a sorted instance from numeric/binary doc
      // values because dedup can be very costly
      throw new IllegalStateException("Type mismatch: " + field + " was indexed as " + info.getDocValuesType());
    } else if (!info.isIndexed()) {
      return DocValues.emptySorted();
    }
    SortedDocValuesImpl impl = (SortedDocValuesImpl) caches.get(SortedDocValues.class).get(reader, new CacheKey(field, acceptableOverheadRatio), false);
    return impl.iterator();
  }
}
项目:lams    文件:FieldCacheImpl.java   
public BinaryDocValues getTerms(AtomicReader reader, String field, boolean setDocsWithField, float acceptableOverheadRatio) throws IOException {
  BinaryDocValues valuesIn = reader.getBinaryDocValues(field);
  if (valuesIn == null) {
    valuesIn = reader.getSortedDocValues(field);
  }

  if (valuesIn != null) {
    // Not cached here by FieldCacheImpl (cached instead
    // per-thread by SegmentReader):
    return valuesIn;
  }

  final FieldInfo info = reader.getFieldInfos().fieldInfo(field);
  if (info == null) {
    return DocValues.emptyBinary();
  } else if (info.hasDocValues()) {
    throw new IllegalStateException("Type mismatch: " + field + " was indexed as " + info.getDocValuesType());
  } else if (!info.isIndexed()) {
    return DocValues.emptyBinary();
  }

  BinaryDocValuesImpl impl = (BinaryDocValuesImpl) caches.get(BinaryDocValues.class).get(reader, new CacheKey(field, acceptableOverheadRatio), setDocsWithField);
  return impl.iterator();
}
项目:lams    文件:FieldCacheImpl.java   
public SortedSetDocValues getDocTermOrds(AtomicReader reader, String field) throws IOException {
  SortedSetDocValues dv = reader.getSortedSetDocValues(field);
  if (dv != null) {
    return dv;
  }

  SortedDocValues sdv = reader.getSortedDocValues(field);
  if (sdv != null) {
    return DocValues.singleton(sdv);
  }

  final FieldInfo info = reader.getFieldInfos().fieldInfo(field);
  if (info == null) {
    return DocValues.emptySortedSet();
  } else if (info.hasDocValues()) {
    throw new IllegalStateException("Type mismatch: " + field + " was indexed as " + info.getDocValuesType());
  } else if (!info.isIndexed()) {
    return DocValues.emptySortedSet();
  }

  DocTermOrds dto = (DocTermOrds) caches.get(DocTermOrds.class).get(reader, new CacheKey(field, null), false);
  return dto.iterator(reader);
}
项目:Elasticsearch    文件:AbstractAtomicOrdinalsFieldData.java   
public static AtomicOrdinalsFieldData empty() {
    return new AbstractAtomicOrdinalsFieldData() {

        @Override
        public long ramBytesUsed() {
            return 0;
        }

        @Override
        public Collection<Accountable> getChildResources() {
            return Collections.emptyList();
        }

        @Override
        public void close() {
        }

        @Override
        public RandomAccessOrds getOrdinalsValues() {
            return DocValues.emptySortedSet();
        }
    };
}
项目:search    文件:MemoryDocValuesProducer.java   
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
  switch(field.getDocValuesType()) {
    case SORTED_SET:
      return DocValues.docsWithValue(getSortedSet(field), maxDoc);
    case SORTED_NUMERIC:
      return DocValues.docsWithValue(getSortedNumeric(field), maxDoc);
    case SORTED:
      return DocValues.docsWithValue(getSorted(field), maxDoc);
    case BINARY:
      BinaryEntry be = binaries.get(field.number);
      return getMissingBits(field.number, be.missingOffset, be.missingBytes);
    case NUMERIC:
      NumericEntry ne = numerics.get(field.number);
      return getMissingBits(field.number, ne.missingOffset, ne.missingBytes);
    default: 
      throw new AssertionError();
  }
}
项目:search    文件:DirectDocValuesProducer.java   
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
  switch(field.getDocValuesType()) {
    case SORTED_SET:
      return DocValues.docsWithValue(getSortedSet(field), maxDoc);
    case SORTED_NUMERIC:
      return DocValues.docsWithValue(getSortedNumeric(field), maxDoc);
    case SORTED:
      return DocValues.docsWithValue(getSorted(field), maxDoc);
    case BINARY:
      BinaryEntry be = binaries.get(field.number);
      return getMissingBits(field.number, be.missingOffset, be.missingBytes);
    case NUMERIC:
      NumericEntry ne = numerics.get(field.number);
      return getMissingBits(field.number, ne.missingOffset, ne.missingBytes);
    default: 
      throw new AssertionError();
  }
}
项目:search    文件:SimpleTextDocValuesReader.java   
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
  switch (field.getDocValuesType()) {
    case SORTED_SET:
      return DocValues.docsWithValue(getSortedSet(field), maxDoc);
    case SORTED_NUMERIC:
      return DocValues.docsWithValue(getSortedNumeric(field), maxDoc);
    case SORTED:
      return DocValues.docsWithValue(getSorted(field), maxDoc);
    case BINARY:
      return getBinaryDocsWithField(field);
    case NUMERIC:
      return getNumericDocsWithField(field);
    default:
      throw new AssertionError();
  }
}
项目:search    文件:DocValuesOrdinalsReader.java   
@Override
public OrdinalsSegmentReader getReader(AtomicReaderContext context) throws IOException {
  BinaryDocValues values0 = context.reader().getBinaryDocValues(field);
  if (values0 == null) {
    values0 = DocValues.emptyBinary();
  }

  final BinaryDocValues values = values0;

  return new OrdinalsSegmentReader() {
    @Override
    public void get(int docID, IntsRef ordinals) throws IOException {
      final BytesRef bytes = values.get(docID);
      decode(bytes, ordinals);
    }
  };
}
项目:search    文件:Lucene45DocValuesProducer.java   
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
  switch(field.getDocValuesType()) {
    case SORTED_SET:
      return DocValues.docsWithValue(getSortedSet(field), maxDoc);
    case SORTED:
      return DocValues.docsWithValue(getSorted(field), maxDoc);
    case BINARY:
      BinaryEntry be = binaries.get(field.number);
      return getMissingBits(be.missingOffset);
    case NUMERIC:
      NumericEntry ne = numerics.get(field.number);
      return getMissingBits(ne.missingOffset);
    default:
      throw new AssertionError();
  }
}
项目:search    文件:Lucene49DocValuesProducer.java   
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
  switch(field.getDocValuesType()) {
    case SORTED_SET:
      return DocValues.docsWithValue(getSortedSet(field), maxDoc);
    case SORTED_NUMERIC:
      return DocValues.docsWithValue(getSortedNumeric(field), maxDoc);
    case SORTED:
      return DocValues.docsWithValue(getSorted(field), maxDoc);
    case BINARY:
      BinaryEntry be = binaries.get(field.number);
      return getMissingBits(be.missingOffset);
    case NUMERIC:
      NumericEntry ne = numerics.get(field.number);
      return getMissingBits(ne.missingOffset);
    default:
      throw new AssertionError();
  }
}
项目:search    文件:Lucene410DocValuesProducer.java   
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
  switch(field.getDocValuesType()) {
    case SORTED_SET:
      return DocValues.docsWithValue(getSortedSet(field), maxDoc);
    case SORTED_NUMERIC:
      return DocValues.docsWithValue(getSortedNumeric(field), maxDoc);
    case SORTED:
      return DocValues.docsWithValue(getSorted(field), maxDoc);
    case BINARY:
      BinaryEntry be = binaries.get(field.number);
      return getMissingBits(be.missingOffset);
    case NUMERIC:
      NumericEntry ne = numerics.get(field.number);
      return getMissingBits(ne.missingOffset);
    default:
      throw new AssertionError();
  }
}
项目:search    文件:FieldCacheImpl.java   
public SortedDocValues getTermsIndex(AtomicReader reader, String field, float acceptableOverheadRatio) throws IOException {
  SortedDocValues valuesIn = reader.getSortedDocValues(field);
  if (valuesIn != null) {
    // Not cached here by FieldCacheImpl (cached instead
    // per-thread by SegmentReader):
    return valuesIn;
  } else {
    final FieldInfo info = reader.getFieldInfos().fieldInfo(field);
    if (info == null) {
      return DocValues.emptySorted();
    } else if (info.hasDocValues()) {
      // we don't try to build a sorted instance from numeric/binary doc
      // values because dedup can be very costly
      throw new IllegalStateException("Type mismatch: " + field + " was indexed as " + info.getDocValuesType());
    } else if (!info.isIndexed()) {
      return DocValues.emptySorted();
    }
    SortedDocValuesImpl impl = (SortedDocValuesImpl) caches.get(SortedDocValues.class).get(reader, new CacheKey(field, acceptableOverheadRatio), false);
    return impl.iterator();
  }
}
项目:search    文件:FieldCacheImpl.java   
public BinaryDocValues getTerms(AtomicReader reader, String field, boolean setDocsWithField, float acceptableOverheadRatio) throws IOException {
  BinaryDocValues valuesIn = reader.getBinaryDocValues(field);
  if (valuesIn == null) {
    valuesIn = reader.getSortedDocValues(field);
  }

  if (valuesIn != null) {
    // Not cached here by FieldCacheImpl (cached instead
    // per-thread by SegmentReader):
    return valuesIn;
  }

  final FieldInfo info = reader.getFieldInfos().fieldInfo(field);
  if (info == null) {
    return DocValues.emptyBinary();
  } else if (info.hasDocValues()) {
    throw new IllegalStateException("Type mismatch: " + field + " was indexed as " + info.getDocValuesType());
  } else if (!info.isIndexed()) {
    return DocValues.emptyBinary();
  }

  BinaryDocValuesImpl impl = (BinaryDocValuesImpl) caches.get(BinaryDocValues.class).get(reader, new CacheKey(field, acceptableOverheadRatio), setDocsWithField);
  return impl.iterator();
}
项目:search    文件:FieldCacheImpl.java   
public SortedSetDocValues getDocTermOrds(AtomicReader reader, String field) throws IOException {
  SortedSetDocValues dv = reader.getSortedSetDocValues(field);
  if (dv != null) {
    return dv;
  }

  SortedDocValues sdv = reader.getSortedDocValues(field);
  if (sdv != null) {
    return DocValues.singleton(sdv);
  }

  final FieldInfo info = reader.getFieldInfos().fieldInfo(field);
  if (info == null) {
    return DocValues.emptySortedSet();
  } else if (info.hasDocValues()) {
    throw new IllegalStateException("Type mismatch: " + field + " was indexed as " + info.getDocValuesType());
  } else if (!info.isIndexed()) {
    return DocValues.emptySortedSet();
  }

  DocTermOrds dto = (DocTermOrds) caches.get(DocTermOrds.class).get(reader, new CacheKey(field, null), false);
  return dto.iterator(reader);
}
项目:neo4j-lucene5-index    文件:IndexReaderStub.java   
public IndexReaderStub( final Map<String,NumericDocValues> ndvs )
{
    this.ndvs = new Function<String,NumericDocValues>()
    {
        @Override
        public NumericDocValues apply( String s )
        {
            NumericDocValues dv = ndvs.get( s );
            if ( dv == null )
            {
                return DocValues.emptyNumeric();
            }
            return dv;
        }
    };
}
项目:read-open-source-code    文件:MemoryDocValuesProducer.java   
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
  switch(field.getDocValuesType()) {
    case SORTED_SET:
      return DocValues.docsWithValue(getSortedSet(field), maxDoc);
    case SORTED_NUMERIC:
      return DocValues.docsWithValue(getSortedNumeric(field), maxDoc);
    case SORTED:
      return DocValues.docsWithValue(getSorted(field), maxDoc);
    case BINARY:
      BinaryEntry be = binaries.get(field.number);
      return getMissingBits(field.number, be.missingOffset, be.missingBytes);
    case NUMERIC:
      NumericEntry ne = numerics.get(field.number);
      return getMissingBits(field.number, ne.missingOffset, ne.missingBytes);
    default: 
      throw new AssertionError();
  }
}
项目:read-open-source-code    文件:DirectDocValuesProducer.java   
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
  switch(field.getDocValuesType()) {
    case SORTED_SET:
      return DocValues.docsWithValue(getSortedSet(field), maxDoc);
    case SORTED_NUMERIC:
      return DocValues.docsWithValue(getSortedNumeric(field), maxDoc);
    case SORTED:
      return DocValues.docsWithValue(getSorted(field), maxDoc);
    case BINARY:
      BinaryEntry be = binaries.get(field.number);
      return getMissingBits(field.number, be.missingOffset, be.missingBytes);
    case NUMERIC:
      NumericEntry ne = numerics.get(field.number);
      return getMissingBits(field.number, ne.missingOffset, ne.missingBytes);
    default: 
      throw new AssertionError();
  }
}
项目:read-open-source-code    文件:Lucene45DocValuesProducer.java   
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
  switch(field.getDocValuesType()) {
    case SORTED_SET:
      return DocValues.docsWithValue(getSortedSet(field), maxDoc);
    case SORTED:
      return DocValues.docsWithValue(getSorted(field), maxDoc);
    case BINARY:
      BinaryEntry be = binaries.get(field.number);
      return getMissingBits(be.missingOffset);
    case NUMERIC:
      NumericEntry ne = numerics.get(field.number);
      return getMissingBits(ne.missingOffset);
    default:
      throw new AssertionError();
  }
}
项目:read-open-source-code    文件:Lucene49DocValuesProducer.java   
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
  switch(field.getDocValuesType()) {
    case SORTED_SET:
      return DocValues.docsWithValue(getSortedSet(field), maxDoc);
    case SORTED_NUMERIC:
      return DocValues.docsWithValue(getSortedNumeric(field), maxDoc);
    case SORTED:
      return DocValues.docsWithValue(getSorted(field), maxDoc);
    case BINARY:
      BinaryEntry be = binaries.get(field.number);
      return getMissingBits(be.missingOffset);
    case NUMERIC:
      NumericEntry ne = numerics.get(field.number);
      return getMissingBits(ne.missingOffset);
    default:
      throw new AssertionError();
  }
}
项目:read-open-source-code    文件:SimpleTextDocValuesReader.java   
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
  switch (field.getDocValuesType()) {
    case SORTED_SET:
      return DocValues.docsWithValue(getSortedSet(field), maxDoc);
    case SORTED_NUMERIC:
      return DocValues.docsWithValue(getSortedNumeric(field), maxDoc);
    case SORTED:
      return DocValues.docsWithValue(getSorted(field), maxDoc);
    case BINARY:
      return getBinaryDocsWithField(field);
    case NUMERIC:
      return getNumericDocsWithField(field);
    default:
      throw new AssertionError();
  }
}
项目:read-open-source-code    文件:Lucene410DocValuesProducer.java   
@Override
public Bits getDocsWithField(FieldInfo field) throws IOException {
  switch(field.getDocValuesType()) {
    case SORTED_SET:
      return DocValues.docsWithValue(getSortedSet(field), maxDoc);
    case SORTED_NUMERIC:
      return DocValues.docsWithValue(getSortedNumeric(field), maxDoc);
    case SORTED:
      return DocValues.docsWithValue(getSorted(field), maxDoc);
    case BINARY:
      BinaryEntry be = binaries.get(field.number);
      return getMissingBits(be.missingOffset);
    case NUMERIC:
      NumericEntry ne = numerics.get(field.number);
      return getMissingBits(ne.missingOffset);
    default:
      throw new AssertionError();
  }
}
项目:read-open-source-code    文件:FieldCacheImpl.java   
public SortedDocValues getTermsIndex(AtomicReader reader, String field, float acceptableOverheadRatio) throws IOException {
  SortedDocValues valuesIn = reader.getSortedDocValues(field);
  if (valuesIn != null) {
    // Not cached here by FieldCacheImpl (cached instead
    // per-thread by SegmentReader):
    return valuesIn;
  } else {
    final FieldInfo info = reader.getFieldInfos().fieldInfo(field);
    if (info == null) {
      return DocValues.emptySorted();
    } else if (info.hasDocValues()) {
      // we don't try to build a sorted instance from numeric/binary doc
      // values because dedup can be very costly
      throw new IllegalStateException("Type mismatch: " + field + " was indexed as " + info.getDocValuesType());
    } else if (!info.isIndexed()) {
      return DocValues.emptySorted();
    }
    SortedDocValuesImpl impl = (SortedDocValuesImpl) caches.get(SortedDocValues.class).get(reader, new CacheKey(field, acceptableOverheadRatio), false);
    return impl.iterator();
  }
}
项目:read-open-source-code    文件:FieldCacheImpl.java   
public BinaryDocValues getTerms(AtomicReader reader, String field, boolean setDocsWithField, float acceptableOverheadRatio) throws IOException {
  BinaryDocValues valuesIn = reader.getBinaryDocValues(field);
  if (valuesIn == null) {
    valuesIn = reader.getSortedDocValues(field);
  }

  if (valuesIn != null) {
    // Not cached here by FieldCacheImpl (cached instead
    // per-thread by SegmentReader):
    return valuesIn;
  }

  final FieldInfo info = reader.getFieldInfos().fieldInfo(field);
  if (info == null) {
    return DocValues.emptyBinary();
  } else if (info.hasDocValues()) {
    throw new IllegalStateException("Type mismatch: " + field + " was indexed as " + info.getDocValuesType());
  } else if (!info.isIndexed()) {
    return DocValues.emptyBinary();
  }

  BinaryDocValuesImpl impl = (BinaryDocValuesImpl) caches.get(BinaryDocValues.class).get(reader, new CacheKey(field, acceptableOverheadRatio), setDocsWithField);
  return impl.iterator();
}
项目:read-open-source-code    文件:FieldCacheImpl.java   
public SortedSetDocValues getDocTermOrds(AtomicReader reader, String field) throws IOException {
  SortedSetDocValues dv = reader.getSortedSetDocValues(field);
  if (dv != null) {
    return dv;
  }

  SortedDocValues sdv = reader.getSortedDocValues(field);
  if (sdv != null) {
    return DocValues.singleton(sdv);
  }

  final FieldInfo info = reader.getFieldInfos().fieldInfo(field);
  if (info == null) {
    return DocValues.emptySortedSet();
  } else if (info.hasDocValues()) {
    throw new IllegalStateException("Type mismatch: " + field + " was indexed as " + info.getDocValuesType());
  } else if (!info.isIndexed()) {
    return DocValues.emptySortedSet();
  }

  DocTermOrds dto = (DocTermOrds) caches.get(DocTermOrds.class).get(reader, new CacheKey(field, null), false);
  return dto.iterator(reader);
}
项目:read-open-source-code    文件:DocValuesOrdinalsReader.java   
@Override
public OrdinalsSegmentReader getReader(AtomicReaderContext context) throws IOException {
  BinaryDocValues values0 = context.reader().getBinaryDocValues(field);
  if (values0 == null) {
    values0 = DocValues.emptyBinary();
  }

  final BinaryDocValues values = values0;

  return new OrdinalsSegmentReader() {
    @Override
    public void get(int docID, IntsRef ordinals) throws IOException {
      final BytesRef bytes = values.get(docID);
      decode(bytes, ordinals);
    }
  };
}
项目:meresco-lucene    文件:DeDupFilterSuperCollector.java   
@Override
public void doSetNextReader(LeafReaderContext 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;
    if (this.sortByFieldName != null)
        sbv = context.reader().getNumericDocValues(this.sortByFieldName);
    if (sbv == null)
        sbv = DocValues.emptyNumeric();
    this.sortByValues = sbv;
    this.delegate.setNextReader(context);
}
项目:elasticsearch_my    文件:ValuesSource.java   
@Override
public Bits docsWithValue(LeafReaderContext context) {
    final RandomAccessOrds ordinals = ordinalsValues(context);
    if (DocValues.unwrapSingleton(ordinals) != null) {
        return DocValues.docsWithValue(DocValues.unwrapSingleton(ordinals), context.reader().maxDoc());
    } else {
        return DocValues.docsWithValue(ordinals, context.reader().maxDoc());
    }
}
项目:elasticsearch_my    文件:MultiOrdinals.java   
@Override
public RandomAccessOrds ordinals(ValuesHolder values) {
    if (multiValued) {
        return new MultiDocs(this, values);
    } else {
        return (RandomAccessOrds) DocValues.singleton(new SingleDocs(this, values));
    }
}
项目:elasticsearch_my    文件:AbstractGeoPointDVIndexFieldData.java   
@Override
public AtomicGeoPointFieldData load(LeafReaderContext context) {
    try {
        return new GeoPointDVAtomicFieldData(DocValues.getSortedNumeric(context.reader(), fieldName));
    } catch (IOException e) {
        throw new IllegalStateException("Cannot load doc values", e);
    }
}
项目:elasticsearch_my    文件:ParentChildIndexFieldData.java   
@Override
public AtomicParentChildFieldData load(LeafReaderContext context) {
    final LeafReader reader = context.reader();
    return new AbstractAtomicParentChildFieldData() {

        public Set<String> types() {
            return parentTypes;
        }

        @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);
            }
        }

        @Override
        public long ramBytesUsed() {
            // unknown
            return 0;
        }

        @Override
        public Collection<Accountable> getChildResources() {
            return Collections.emptyList();
        }

        @Override
        public void close() throws ElasticsearchException {
        }
    };
}
项目:elasticsearch_my    文件:SortedNumericDVIndexFieldData.java   
@Override
public SortedNumericDocValues getLongValues() {
    try {
        return DocValues.getSortedNumeric(reader, field);
    } catch (IOException e) {
        throw new IllegalStateException("Cannot load doc values", e);
    }
}
项目:elasticsearch_my    文件:SortedNumericDVIndexFieldData.java   
@Override
public SortedNumericDoubleValues getDoubleValues() {
    try {
        SortedNumericDocValues raw = DocValues.getSortedNumeric(reader, field);

        NumericDocValues single = DocValues.unwrapSingleton(raw);
        if (single != null) {
            return FieldData.singleton(new SingleHalfFloatValues(single), DocValues.unwrapSingletonBits(raw));
        } else {
            return new MultiHalfFloatValues(raw);
        }
    } catch (IOException e) {
        throw new IllegalStateException("Cannot load doc values", e);
    }
}