Examples of seekExact()


Examples of org.apache.lucene.index.TermsEnum.seekExact()

    final Terms terms = MultiFields.getTerms(r, field);
    if (terms == null) {
      return null;
    }
    final TermsEnum termsEnum = terms.iterator(null);
    if (!termsEnum.seekExact(term)) {
      return null;
    }
    return docs(random, termsEnum, liveDocs, reuse, flags);
  }
View Full Code Here

Examples of org.apache.lucene.index.TermsEnum.seekExact()

      DocsEnum docs = null; // reuse
      for (AtomicReaderContext ctx : reader.leaves()) {
        Terms terms = ctx.reader().terms(Consts.FULL);
        if (terms != null) {
          termsEnum = terms.iterator(termsEnum);
          if (termsEnum.seekExact(catTerm)) {
            // liveDocs=null because the taxonomy has no deletes
            docs = termsEnum.docs(null, docs, 0 /* freqs not required */);
            // if the term was found, we know it has exactly one document.
            doc = docs.nextDoc() + ctx.docBase;
            break;
View Full Code Here

Examples of org.apache.lucene.index.TermsEnum.seekExact()

        assert this.termNotInReader(context.reader(), term) : "no termstate found but term exists in reader term=" + term;
        return null;
      }
      //System.out.println("LD=" + reader.getLiveDocs() + " set?=" + (reader.getLiveDocs() != null ? reader.getLiveDocs().get(0) : "null"));
      final TermsEnum termsEnum = context.reader().terms(term.field()).iterator(null);
      termsEnum.seekExact(term.bytes(), state);
      return termsEnum;
    }

    private boolean termNotInReader(final AtomicReader reader, final Term term) throws IOException {
      // only called from assert
View Full Code Here

Examples of org.apache.lucene.index.TermsEnum.seekExact()

        final TermState state = states[i].get(context.ord);
        if (state == null) { /* term doesnt exist in this segment */
          assert this.termNotInReader(reader, t): "no termstate found but term exists in reader";
          return null;
        }
        te.seekExact(t.bytes(), state);

        final DocsNodesAndPositionsEnum postingsEnum = NodePhraseQuery.this.getDocsNodesAndPositionsEnum(te.docsAndPositions(liveDocs, null));

        // PhraseQuery on a field that did not index positions (maybe not a siren field)
        if (postingsEnum == null) {
View Full Code Here

Examples of org.apache.lucene.index.TermsEnum.seekExact()

        final DocsNodesAndPositionsEnum postingsEnum = NodePhraseQuery.this.getDocsNodesAndPositionsEnum(te.docsAndPositions(liveDocs, null));

        // PhraseQuery on a field that did not index positions (maybe not a siren field)
        if (postingsEnum == null) {
          assert te.seekExact(t.bytes(), false) : "termstate found but no term exists in reader";
          // term does exist, but has no positions
          throw new IllegalStateException("field \"" + t.field() + "\" was " +
              "indexed without position data; cannot run NodePhraseQuery " +
              "(term=" + t.text() + ")");
        }
View Full Code Here

Examples of org.apache.lucene.index.TermsEnum.seekExact()

          if (termsEnum == null) {
            nullCount++;
            continue;
          }
          for(int i=0;i<drillDownTerms[dim].length;i++) {
            if (termsEnum.seekExact(drillDownTerms[dim][i].bytes())) {
              DocsEnum docsEnum = termsEnum.docs(null, null, 0);
              if (docsEnum != null) {
                dims[dim].docsEnums[i] = docsEnum;
                dims[dim].maxCost = Math.max(dims[dim].maxCost, docsEnum.cost());
              }
View Full Code Here

Examples of org.apache.lucene.index.TermsEnum.seekExact()

          }
        }

        final TermsEnum.SeekStatus status;
        if (nextID == null) {
          if (termsEnum.seekExact(new BytesRef(id))) {
            status = TermsEnum.SeekStatus.FOUND;
          } else {
            status = TermsEnum.SeekStatus.NOT_FOUND;
          }
        } else {
View Full Code Here

Examples of org.apache.lucene.index.TermsEnum.seekExact()

            TermState termState = termContexts.get(term).get(context.ord);
            if (termState == null) {
              // Term not in reader
              continue;
            }
            termsEnum.seekExact(term.bytes(), termState);
            docFreq += termsEnum.docFreq();
          }

          if (docFreq == 0) {
            // None of the terms are in this reader
View Full Code Here

Examples of org.apache.lucene.index.TermsEnum.seekExact()

          TermState termState = termContexts.get(term).get(context.ord);
          if (termState == null) {
            // Term not in reader
            return null;
          }
          termsEnum.seekExact(term.bytes(), termState);
          postingsEnum = termsEnum.docsAndPositions(liveDocs, null, DocsEnum.FLAG_NONE);

          if (postingsEnum == null) {
            // term does exist, but has no positions
            assert termsEnum.docs(liveDocs, null, DocsEnum.FLAG_NONE) != null: "termstate found but no term exists in reader";
View Full Code Here

Examples of org.apache.lucene.index.TermsEnum.seekExact()

        assert termNotInReader(context.reader(), term) : "no termstate found but term exists in reader term=" + term;
        return null;
      }
      //System.out.println("LD=" + reader.getLiveDocs() + " set?=" + (reader.getLiveDocs() != null ? reader.getLiveDocs().get(0) : "null"));
      final TermsEnum termsEnum = context.reader().terms(term.field()).iterator(null);
      termsEnum.seekExact(term.bytes(), state);
      return termsEnum;
    }
   
    private boolean termNotInReader(AtomicReader reader, Term term) throws IOException {
      // only called from assert
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.