org.apache.lucene.util.BitSet.cardinality()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中org.apache.lucene.util.BitSet.cardinality()方法的一些代码示例,展示了BitSet.cardinality()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BitSet.cardinality()方法的具体详情如下:
包路径:org.apache.lucene.util.BitSet
类名称:BitSet
方法名:cardinality

BitSet.cardinality介绍

[英]Return the number of bits that are set. NOTE: this method is likely to run in linear time
[中]返回设置的位数。注:此方法可能以线性时间运行

代码示例

代码示例来源:origin: org.apache.lucene/lucene-core

/**
 * Return an approximation of the cardinality of this set. Some
 * implementations may trade accuracy for speed if they have the ability to
 * estimate the cardinality of the set without iterating over all the data.
 * The default implementation returns {@link #cardinality()}.
 */
public int approximateCardinality() {
 return cardinality();
}

代码示例来源:origin: org.apache.lucene/lucene-core

@Override
 public long cost() {
  return dvs.docsWithField.cardinality();
 }
}

代码示例来源:origin: org.apache.lucene/lucene-core

@Override
 public long cost() {
  return dvs.docsWithField.cardinality();
 }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

@Override
 public long cost() {
  return dvs.docsWithField.cardinality();
 }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/**
 * Return an approximation of the cardinality of this set. Some
 * implementations may trade accuracy for speed if they have the ability to
 * estimate the cardinality of the set without iterating over all the data.
 * The default implementation returns {@link #cardinality()}.
 */
public int approximateCardinality() {
 return cardinality();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

@Override
 public long cost() {
  return dvs.docsWithField.cardinality();
 }
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

/**
 * Return an approximation of the cardinality of this set. Some
 * implementations may trade accuracy for speed if they have the ability to
 * estimate the cardinality of the set without iterating over all the data.
 * The default implementation returns {@link #cardinality()}.
 */
public int approximateCardinality() {
 return cardinality();
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Return an approximation of the cardinality of this set. Some
 * implementations may trade accuracy for speed if they have the ability to
 * estimate the cardinality of the set without iterating over all the data.
 * The default implementation returns {@link #cardinality()}.
 */
public int approximateCardinality() {
 return cardinality();
}

代码示例来源:origin: org.codelibs.elasticsearch.module/percolator

static int[] buildRootDocsSlots(BitSet rootDocs) {
    int slot = 0;
    int[] rootDocsBySlot = new int[rootDocs.cardinality()];
    BitSetIterator iterator = new BitSetIterator(rootDocs, 0);
    for (int rootDocId = iterator.nextDoc(); rootDocId != NO_MORE_DOCS; rootDocId = iterator.nextDoc()) {
      rootDocsBySlot[slot++] = rootDocId;
    }
    return rootDocsBySlot;
  }
}

代码示例来源:origin: org.elasticsearch.plugin/percolator-client

static int[] buildRootDocsSlots(BitSet rootDocs) {
    int slot = 0;
    int[] rootDocsBySlot = new int[rootDocs.cardinality()];
    BitSetIterator iterator = new BitSetIterator(rootDocs, 0);
    for (int rootDocId = iterator.nextDoc(); rootDocId != NO_MORE_DOCS; rootDocId = iterator.nextDoc()) {
      rootDocsBySlot[slot++] = rootDocId;
    }
    return rootDocsBySlot;
  }
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

public TokenRangesLeafReader(DirectoryReader directoryReader, LeafReader in, Query query, TokenRangesBitsetFilterCache cache) throws IOException {
  super(in);
  try {
    in.addCoreClosedListener(cache);
    ElasticsearchDirectoryReader.addReaderCloseListener(directoryReader, cache);
    //in.addReaderClosedListener(cache);
    this.mask = cache.getBitSet(query, in.getContext());
    if (mask == null) {
      numDocs = 0;
      hasDeletions = true;
      noBitMatch = new Bits.MatchNoBits(in.maxDoc());
    } else {
      numDocs = mask.cardinality();
      hasDeletions = numDocs < in.numDocs() || in.hasDeletions();
      noBitMatch = null;
    }
  } catch (ExecutionException e) {
    throw new IOException(e);
  }
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

logger.trace("no tombstone, query={} coreCacheKey={} segment={} cardinality={}", query, key, reader, bitset.cardinality());
} else  {
  bitset = BitSet.of(fit, reader.maxDoc());
  if (logger.isTraceEnabled())
    logger.trace("has tombstones, query={} coreCacheKey={} segment={} cardinality={}", query, key, reader, bitset.cardinality());

代码示例来源:origin: org.elasticsearch.plugin/percolator-client

BitSet rootDocs = BitSet.of(s.iterator(), memoryIndexMaxDoc);
int[] rootDocsBySlot = null;
boolean hasNestedDocs = rootDocs.cardinality() != percolatorIndexSearcher.getIndexReader().numDocs();
if (hasNestedDocs) {
  rootDocsBySlot = buildRootDocsSlots(rootDocs);

代码示例来源:origin: harbby/presto-connectors

numDocs += bits.cardinality();

代码示例来源:origin: org.codelibs.elasticsearch.module/percolator

BitSet rootDocs = BitSet.of(s.iterator(), memoryIndexMaxDoc);
int[] rootDocsBySlot = null;
boolean hasNestedDocs = rootDocs.cardinality() != percolatorIndexSearcher.getIndexReader().numDocs();
if (hasNestedDocs) {
  rootDocsBySlot = buildRootDocsSlots(rootDocs);

代码示例来源:origin: harbby/presto-connectors

if (parents == null || parents.cardinality() == 0) {
 throw new IllegalStateException("Every segment should have at least one parent, but " + context.reader() + " does not have any");

相关文章