当前位置: 首页>>代码示例>>Java>>正文


Java FieldInfo.hasDocValues方法代码示例

本文整理汇总了Java中org.apache.lucene.index.FieldInfo.hasDocValues方法的典型用法代码示例。如果您正苦于以下问题:Java FieldInfo.hasDocValues方法的具体用法?Java FieldInfo.hasDocValues怎么用?Java FieldInfo.hasDocValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.lucene.index.FieldInfo的用法示例。


在下文中一共展示了FieldInfo.hasDocValues方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBytes

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
@Override
public Bytes getBytes(AtomicReader reader, String field, ByteParser parser, boolean setDocsWithField)
    throws IOException {
  final NumericDocValues valuesIn = reader.getNumericDocValues(field);
  if (valuesIn != null) {
    // Not cached here by FieldCacheImpl (cached instead
    // per-thread by SegmentReader):
    return new Bytes() {
      @Override
      public byte get(int docID) {
        return (byte) valuesIn.get(docID);
      }
    };
  } else {
    final FieldInfo info = reader.getFieldInfos().fieldInfo(field);
    if (info == null) {
      return Bytes.EMPTY;
    } else if (info.hasDocValues()) {
      throw new IllegalStateException("Type mismatch: " + field + " was indexed as " + info.getDocValuesType());
    } else if (!info.isIndexed()) {
      return Bytes.EMPTY;
    }
    return (Bytes) caches.get(Byte.TYPE).get(reader, new CacheKey(field, parser), setDocsWithField);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:FieldCacheImpl.java

示例2: getShorts

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
public Shorts getShorts(AtomicReader reader, String field, ShortParser parser, boolean setDocsWithField)
    throws IOException {
  final NumericDocValues valuesIn = reader.getNumericDocValues(field);
  if (valuesIn != null) {
    // Not cached here by FieldCacheImpl (cached instead
    // per-thread by SegmentReader):
    return new Shorts() {
      @Override
      public short get(int docID) {
        return (short) valuesIn.get(docID);
      }
    };
  } else {
    final FieldInfo info = reader.getFieldInfos().fieldInfo(field);
    if (info == null) {
      return Shorts.EMPTY;
    } else if (info.hasDocValues()) {
      throw new IllegalStateException("Type mismatch: " + field + " was indexed as " + info.getDocValuesType());
    } else if (!info.isIndexed()) {
      return Shorts.EMPTY;
    }
    return (Shorts) caches.get(Short.TYPE).get(reader, new CacheKey(field, parser), setDocsWithField);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:FieldCacheImpl.java

示例3: getInts

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
@Override
public Ints getInts(AtomicReader reader, String field, IntParser parser, boolean setDocsWithField)
    throws IOException {
  final NumericDocValues valuesIn = reader.getNumericDocValues(field);
  if (valuesIn != null) {
    // Not cached here by FieldCacheImpl (cached instead
    // per-thread by SegmentReader):
    return new Ints() {
      @Override
      public int get(int docID) {
        return (int) valuesIn.get(docID);
      }
    };
  } else {
    final FieldInfo info = reader.getFieldInfos().fieldInfo(field);
    if (info == null) {
      return Ints.EMPTY;
    } else if (info.hasDocValues()) {
      throw new IllegalStateException("Type mismatch: " + field + " was indexed as " + info.getDocValuesType());
    } else if (!info.isIndexed()) {
      return Ints.EMPTY;
    }
    return (Ints) caches.get(Integer.TYPE).get(reader, new CacheKey(field, parser), setDocsWithField);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:FieldCacheImpl.java

示例4: getFloats

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
@Override
public Floats getFloats(AtomicReader reader, String field, FloatParser parser, boolean setDocsWithField)
  throws IOException {
  final NumericDocValues valuesIn = reader.getNumericDocValues(field);
  if (valuesIn != null) {
    // Not cached here by FieldCacheImpl (cached instead
    // per-thread by SegmentReader):
    return new Floats() {
      @Override
      public float get(int docID) {
        return Float.intBitsToFloat((int) valuesIn.get(docID));
      }
    };
  } else {
    final FieldInfo info = reader.getFieldInfos().fieldInfo(field);
    if (info == null) {
      return Floats.EMPTY;
    } else if (info.hasDocValues()) {
      throw new IllegalStateException("Type mismatch: " + field + " was indexed as " + info.getDocValuesType());
    } else if (!info.isIndexed()) {
      return Floats.EMPTY;
    }
    return (Floats) caches.get(Float.TYPE).get(reader, new CacheKey(field, parser), setDocsWithField);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:FieldCacheImpl.java

示例5: getLongs

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
@Override
public Longs getLongs(AtomicReader reader, String field, FieldCache.LongParser parser, boolean setDocsWithField)
    throws IOException {
  final NumericDocValues valuesIn = reader.getNumericDocValues(field);
  if (valuesIn != null) {
    // Not cached here by FieldCacheImpl (cached instead
    // per-thread by SegmentReader):
    return new Longs() {
      @Override
      public long get(int docID) {
        return valuesIn.get(docID);
      }
    };
  } else {
    final FieldInfo info = reader.getFieldInfos().fieldInfo(field);
    if (info == null) {
      return Longs.EMPTY;
    } else if (info.hasDocValues()) {
      throw new IllegalStateException("Type mismatch: " + field + " was indexed as " + info.getDocValuesType());
    } else if (!info.isIndexed()) {
      return Longs.EMPTY;
    }
    return (Longs) caches.get(Long.TYPE).get(reader, new CacheKey(field, parser), setDocsWithField);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:FieldCacheImpl.java

示例6: getDoubles

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
@Override
public Doubles getDoubles(AtomicReader reader, String field, FieldCache.DoubleParser parser, boolean setDocsWithField)
    throws IOException {
  final NumericDocValues valuesIn = reader.getNumericDocValues(field);
  if (valuesIn != null) {
    // Not cached here by FieldCacheImpl (cached instead
    // per-thread by SegmentReader):
    return new Doubles() {
      @Override
      public double get(int docID) {
        return Double.longBitsToDouble(valuesIn.get(docID));
      }
    };
  } else {
    final FieldInfo info = reader.getFieldInfos().fieldInfo(field);
    if (info == null) {
      return Doubles.EMPTY;
    } else if (info.hasDocValues()) {
      throw new IllegalStateException("Type mismatch: " + field + " was indexed as " + info.getDocValuesType());
    } else if (!info.isIndexed()) {
      return Doubles.EMPTY;
    }
    return (Doubles) caches.get(Double.TYPE).get(reader, new CacheKey(field, parser), setDocsWithField);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:FieldCacheImpl.java

示例7: getTermsIndex

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
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();
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:FieldCacheImpl.java

示例8: getTerms

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
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();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:FieldCacheImpl.java

示例9: getDocTermOrds

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
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);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:FieldCacheImpl.java

示例10: getDocsWithField

import org.apache.lucene.index.FieldInfo; //导入方法依赖的package包/类
public Bits getDocsWithField(AtomicReader reader, String field) throws IOException {
  final FieldInfo fieldInfo = reader.getFieldInfos().fieldInfo(field);
  if (fieldInfo == null) {
    // field does not exist or has no value
    return new Bits.MatchNoBits(reader.maxDoc());
  } else if (fieldInfo.hasDocValues()) {
    return reader.getDocsWithField(field);
  } else if (!fieldInfo.isIndexed()) {
    return new Bits.MatchNoBits(reader.maxDoc());
  }
  BitsEntry entry = (BitsEntry) caches.get(DocsWithFieldCache.class).get(reader, new CacheKey(field, null), false);
  return entry.bits;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:FieldCacheImpl.java


注:本文中的org.apache.lucene.index.FieldInfo.hasDocValues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。