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


Java Bits.MatchNoBits方法代码示例

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


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

示例1: getLeafCollector

import org.apache.lucene.util.Bits; //导入方法依赖的package包/类
@Override
public LeafBucketCollector getLeafCollector(LeafReaderContext ctx,
        final LeafBucketCollector sub) throws IOException {

    final Bits docsWithValue;
    if (valuesSource != null) {
        docsWithValue = valuesSource.docsWithValue(ctx);
    } else {
        docsWithValue = new Bits.MatchNoBits(ctx.reader().maxDoc());
    }
    return new LeafBucketCollectorBase(sub, docsWithValue) {
        @Override
        public void collect(int doc, long bucket) throws IOException {
            if (docsWithValue != null && !docsWithValue.get(doc)) {
                collectBucket(sub, doc, bucket);
            }
        }
    };
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:20,代码来源:MissingAggregator.java

示例2: ramBytesUsed

import org.apache.lucene.util.Bits; //导入方法依赖的package包/类
@Override
public long ramBytesUsed() {
  long base = RamUsageEstimator.NUM_BYTES_OBJECT_REF;
  if (bits instanceof Bits.MatchAllBits || bits instanceof Bits.MatchNoBits) {
    return base;
  } else {
    return base + (bits.length() >>> 3);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:FieldCacheImpl.java

示例3: getDocsWithField

import org.apache.lucene.util.Bits; //导入方法依赖的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

示例4: getDocsWithField

import org.apache.lucene.util.Bits; //导入方法依赖的package包/类
/**
 * Returns Bits for the reader, or {@link Bits} matching nothing if it has none. 
 */
public static Bits getDocsWithField(AtomicReader in, String field) throws IOException {
  Bits dv = in.getDocsWithField(field);
  if (dv == null) {
    return new Bits.MatchNoBits(in.maxDoc());
  } else {
    return dv;
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:DocValues.java

示例5: getDocsWithField

import org.apache.lucene.util.Bits; //导入方法依赖的package包/类
/** Returns a Bits for a reader's docsWithField (potentially merging on-the-fly) 
 * <p>
 * This is a slow way to access this bitset. Instead, access them per-segment
 * with {@link AtomicReader#getDocsWithField(String)}
 * </p> 
 * */
public static Bits getDocsWithField(final IndexReader r, final String field) throws IOException {
  final List<AtomicReaderContext> leaves = r.leaves();
  final int size = leaves.size();
  if (size == 0) {
    return null;
  } else if (size == 1) {
    return leaves.get(0).reader().getDocsWithField(field);
  }

  boolean anyReal = false;
  boolean anyMissing = false;
  final Bits[] values = new Bits[size];
  final int[] starts = new int[size+1];
  for (int i = 0; i < size; i++) {
    AtomicReaderContext context = leaves.get(i);
    Bits v = context.reader().getDocsWithField(field);
    if (v == null) {
      v = new Bits.MatchNoBits(context.reader().maxDoc());
      anyMissing = true;
    } else {
      anyReal = true;
      if (v instanceof Bits.MatchAllBits == false) {
        anyMissing = true;
      }
    }
    values[i] = v;
    starts[i] = context.docBase;
  }
  starts[size] = r.maxDoc();

  if (!anyReal) {
    return null;
  } else if (!anyMissing) {
    return new Bits.MatchAllBits(r.maxDoc());
  } else {
    return new MultiBits(values, starts, false);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:45,代码来源:MultiDocValues.java


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