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

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

本文整理了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

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

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

  1. @Override
  2. public long cost() {
  3. return dvs.docsWithField.cardinality();
  4. }
  5. }

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

  1. @Override
  2. public long cost() {
  3. return dvs.docsWithField.cardinality();
  4. }
  5. }

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

  1. @Override
  2. public long cost() {
  3. return dvs.docsWithField.cardinality();
  4. }
  5. }

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

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

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

  1. @Override
  2. public long cost() {
  3. return dvs.docsWithField.cardinality();
  4. }
  5. }

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

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

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

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

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

  1. static int[] buildRootDocsSlots(BitSet rootDocs) {
  2. int slot = 0;
  3. int[] rootDocsBySlot = new int[rootDocs.cardinality()];
  4. BitSetIterator iterator = new BitSetIterator(rootDocs, 0);
  5. for (int rootDocId = iterator.nextDoc(); rootDocId != NO_MORE_DOCS; rootDocId = iterator.nextDoc()) {
  6. rootDocsBySlot[slot++] = rootDocId;
  7. }
  8. return rootDocsBySlot;
  9. }
  10. }

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

  1. static int[] buildRootDocsSlots(BitSet rootDocs) {
  2. int slot = 0;
  3. int[] rootDocsBySlot = new int[rootDocs.cardinality()];
  4. BitSetIterator iterator = new BitSetIterator(rootDocs, 0);
  5. for (int rootDocId = iterator.nextDoc(); rootDocId != NO_MORE_DOCS; rootDocId = iterator.nextDoc()) {
  6. rootDocsBySlot[slot++] = rootDocId;
  7. }
  8. return rootDocsBySlot;
  9. }
  10. }

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

  1. public TokenRangesLeafReader(DirectoryReader directoryReader, LeafReader in, Query query, TokenRangesBitsetFilterCache cache) throws IOException {
  2. super(in);
  3. try {
  4. in.addCoreClosedListener(cache);
  5. ElasticsearchDirectoryReader.addReaderCloseListener(directoryReader, cache);
  6. //in.addReaderClosedListener(cache);
  7. this.mask = cache.getBitSet(query, in.getContext());
  8. if (mask == null) {
  9. numDocs = 0;
  10. hasDeletions = true;
  11. noBitMatch = new Bits.MatchNoBits(in.maxDoc());
  12. } else {
  13. numDocs = mask.cardinality();
  14. hasDeletions = numDocs < in.numDocs() || in.hasDeletions();
  15. noBitMatch = null;
  16. }
  17. } catch (ExecutionException e) {
  18. throw new IOException(e);
  19. }
  20. }

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

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

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

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

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

  1. numDocs += bits.cardinality();

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

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

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

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

相关文章