Java 类org.apache.lucene.util.LongBitSet 实例源码

项目:elasticsearch_my    文件:IncludeExcludeTests.java   
public void testEmptyTermsWithOrds() throws IOException {
    IncludeExclude inexcl = new IncludeExclude(
            new TreeSet<>(Collections.singleton(new BytesRef("foo"))),
            null);
    OrdinalsFilter filter = inexcl.convertToOrdinalsFilter(DocValueFormat.RAW);
    LongBitSet acceptedOrds = filter.acceptedGlobalOrdinals(DocValues.emptySortedSet());
    assertEquals(0, acceptedOrds.length());

    inexcl = new IncludeExclude(
            null,
            new TreeSet<>(Collections.singleton(new BytesRef("foo"))));
    filter = inexcl.convertToOrdinalsFilter(DocValueFormat.RAW);
    acceptedOrds = filter.acceptedGlobalOrdinals(DocValues.emptySortedSet());
    assertEquals(0, acceptedOrds.length());
}
项目:Elasticsearch    文件:ChildrenConstantScoreQuery.java   
@Override
public Scorer scorer(LeafReaderContext context) throws IOException {
    if (remaining == 0) {
        return null;
    }

    if (shortCircuitFilter != null) {
        DocIdSet docIdSet = shortCircuitFilter.getDocIdSet(context, null);
        if (!Lucene.isEmpty(docIdSet)) {
            DocIdSetIterator iterator = docIdSet.iterator();
            if (iterator != null) {
                return ConstantScorer.create(iterator, this, queryWeight);
            }
        }
        return null;
    }

    DocIdSet parentDocIdSet = this.parentFilter.getDocIdSet(context, null);
    if (!Lucene.isEmpty(parentDocIdSet)) {
        // We can't be sure of the fact that liveDocs have been applied, so we apply it here. The "remaining"
        // count down (short circuit) logic will then work as expected.
        parentDocIdSet = BitsFilteredDocIdSet.wrap(parentDocIdSet, context.reader().getLiveDocs());
        DocIdSetIterator innerIterator = parentDocIdSet.iterator();
        if (innerIterator != null) {
            LongBitSet parentOrds = collector.parentOrds;
            SortedDocValues globalValues = globalIfd.load(context).getOrdinalsValues(parentType);
            if (globalValues != null) {
                DocIdSetIterator parentIdIterator = new ParentOrdIterator(innerIterator, parentOrds, globalValues, this);
                return ConstantScorer.create(parentIdIterator, this, queryWeight);
            }
        }
    }
    return null;
}
项目:elasticsearch_my    文件:HyperLogLogPlusPlus.java   
void ensureCapacity(long bit) {
    impl = LongBitSet.ensureCapacity(impl, bit);
}
项目:elasticsearch_my    文件:GlobalOrdinalsStringTermsAggregator.java   
private FilteredOrdinals(RandomAccessOrds inner, LongBitSet accepted) {
    this.inner = inner;
    this.accepted = accepted;
}
项目:elasticsearch_my    文件:IncludeExcludeTests.java   
public void testSingleTermWithOrds() throws IOException {
    RandomAccessOrds ords = new RandomAccessOrds() {

        boolean consumed = true;

        @Override
        public void setDocument(int docID) {
            consumed = false;
        }

        @Override
        public long nextOrd() {
            if (consumed) {
                return SortedSetDocValues.NO_MORE_ORDS;
            } else {
                consumed = true;
                return 0;
            }
        }

        @Override
        public BytesRef lookupOrd(long ord) {
            assertEquals(0, ord);
            return new BytesRef("foo");
        }

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

        @Override
        public long ordAt(int index) {
            return 0;
        }

        @Override
        public int cardinality() {
            return 1;
        }
    };
    IncludeExclude inexcl = new IncludeExclude(
            new TreeSet<>(Collections.singleton(new BytesRef("foo"))),
            null);
    OrdinalsFilter filter = inexcl.convertToOrdinalsFilter(DocValueFormat.RAW);
    LongBitSet acceptedOrds = filter.acceptedGlobalOrdinals(ords);
    assertEquals(1, acceptedOrds.length());
    assertTrue(acceptedOrds.get(0));

    inexcl = new IncludeExclude(
            new TreeSet<>(Collections.singleton(new BytesRef("bar"))),
            null);
    filter = inexcl.convertToOrdinalsFilter(DocValueFormat.RAW);
    acceptedOrds = filter.acceptedGlobalOrdinals(ords);
    assertEquals(1, acceptedOrds.length());
    assertFalse(acceptedOrds.get(0));

    inexcl = new IncludeExclude(
            new TreeSet<>(Collections.singleton(new BytesRef("foo"))),
            new TreeSet<>(Collections.singleton(new BytesRef("foo"))));
    filter = inexcl.convertToOrdinalsFilter(DocValueFormat.RAW);
    acceptedOrds = filter.acceptedGlobalOrdinals(ords);
    assertEquals(1, acceptedOrds.length());
    assertFalse(acceptedOrds.get(0));

    inexcl = new IncludeExclude(
            null, // means everything included
            new TreeSet<>(Collections.singleton(new BytesRef("foo"))));
    filter = inexcl.convertToOrdinalsFilter(DocValueFormat.RAW);
    acceptedOrds = filter.acceptedGlobalOrdinals(ords);
    assertEquals(1, acceptedOrds.length());
    assertFalse(acceptedOrds.get(0));
}
项目:lams    文件:DocValuesConsumer.java   
BitsFilteredTermsEnum(TermsEnum in, LongBitSet liveTerms) {
  super(in, false); // <-- not passing false here wasted about 3 hours of my time!!!!!!!!!!!!!
  assert liveTerms != null;
  this.liveTerms = liveTerms;
}
项目:Elasticsearch    文件:HyperLogLogPlusPlus.java   
void ensureCapacity(long bit) {
    impl = LongBitSet.ensureCapacity(impl, bit);
}
项目:Elasticsearch    文件:GlobalOrdinalsStringTermsAggregator.java   
private FilteredOrdinals(RandomAccessOrds inner, LongBitSet accepted) {
    this.inner = inner;
    this.accepted = accepted;
}
项目:Elasticsearch    文件:ParentConstantScoreQuery.java   
ChildrenDocIdIterator(DocIdSetIterator innerIterator, LongBitSet parentOrds, SortedDocValues globalOrdinals) {
    super(innerIterator);
    this.parentOrds = parentOrds;
    this.globalOrdinals = globalOrdinals;
}
项目:Elasticsearch    文件:ParentConstantScoreQuery.java   
ParentOrdsCollector(IndexParentChildFieldData globalIfd, long maxOrd, String parentType) {
    this.parentOrds = new LongBitSet(maxOrd);
    this.globalIfd = globalIfd;
    this.parentType = parentType;
}
项目:Elasticsearch    文件:ChildrenConstantScoreQuery.java   
private ParentOrdCollector(IndexParentChildFieldData indexFieldData, long maxOrd, String parentType) {
    // TODO: look into reusing LongBitSet#bits array
    this.parentOrds = new LongBitSet(maxOrd + 1);
    this.indexFieldData = indexFieldData;
    this.parentType = parentType;
}
项目:Elasticsearch    文件:ChildrenConstantScoreQuery.java   
private ParentOrdIterator(DocIdSetIterator innerIterator, LongBitSet parentOrds, SortedDocValues ordinals, ParentWeight parentWeight) {
    super(innerIterator);
    this.parentOrds = parentOrds;
    this.ordinals = ordinals;
    this.parentWeight = parentWeight;
}
项目:search    文件:DocValuesConsumer.java   
BitsFilteredTermsEnum(TermsEnum in, LongBitSet liveTerms) {
  super(in, false); // <-- not passing false here wasted about 3 hours of my time!!!!!!!!!!!!!
  assert liveTerms != null;
  this.liveTerms = liveTerms;
}
项目:search    文件:BlockLocks.java   
public BlockLocks(long numBits) {
  int length = LongBitSet.bits2words(numBits);
  bits = new AtomicLongArray(length);
  wlen = length;
}
项目:read-open-source-code    文件:DocValuesConsumer.java   
BitsFilteredTermsEnum(TermsEnum in, LongBitSet liveTerms) {
  super(in, false); // <-- not passing false here wasted about 3 hours of my time!!!!!!!!!!!!!
  assert liveTerms != null;
  this.liveTerms = liveTerms;
}
项目:read-open-source-code    文件:BlockLocks.java   
public BlockLocks(long numBits) {
  int length = LongBitSet.bits2words(numBits);
  bits = new AtomicLongArray(length);
  wlen = length;
}
项目:read-open-source-code    文件:DocValuesConsumer.java   
BitsFilteredTermsEnum(TermsEnum in, LongBitSet liveTerms) {
  super(in, false); // <-- not passing false here wasted about 3 hours of my time!!!!!!!!!!!!!
  assert liveTerms != null;
  this.liveTerms = liveTerms;
}
项目:read-open-source-code    文件:DocValuesConsumer.java   
BitsFilteredTermsEnum(TermsEnum in, LongBitSet liveTerms) {
  super(in, false); // <-- not passing false here wasted about 3 hours of my time!!!!!!!!!!!!!
  assert liveTerms != null;
  this.liveTerms = liveTerms;
}
项目:read-open-source-code    文件:BlockLocks.java   
public BlockLocks(long numBits) {
  int length = LongBitSet.bits2words(numBits);
  bits = new AtomicLongArray(length);
  wlen = length;
}
项目:elasticsearch_my    文件:IncludeExclude.java   
public abstract LongBitSet acceptedGlobalOrdinals(RandomAccessOrds globalOrdinals) throws IOException;
项目:Elasticsearch    文件:IncludeExclude.java   
public abstract LongBitSet acceptedGlobalOrdinals(RandomAccessOrds globalOrdinals, ValuesSource.Bytes.WithOrdinals valueSource) throws IOException;