Examples of reader()


Examples of org.apache.lucene.index.AtomicReaderContext.reader()

    w.close();
    assertEquals(1, reader.leaves().size());
    AtomicReaderContext context = reader.leaves().get(0);
    TermsFilter tf = new TermsFilter(new ArrayList<Term>(terms));

    FixedBitSet bits = (FixedBitSet) tf.getDocIdSet(context, context.reader().getLiveDocs());
    assertEquals(context.reader().numDocs(), bits.cardinality())
    reader.close();
    dir.close();
  }
 
View Full Code Here

Examples of org.apache.lucene.index.AtomicReaderContext.reader()

    assertEquals(1, reader.leaves().size());
    AtomicReaderContext context = reader.leaves().get(0);
    TermsFilter tf = new TermsFilter(new ArrayList<Term>(terms));

    FixedBitSet bits = (FixedBitSet) tf.getDocIdSet(context, context.reader().getLiveDocs());
    assertEquals(context.reader().numDocs(), bits.cardinality())
    reader.close();
    dir.close();
  }
 
  public void testRandom() throws IOException {
View Full Code Here

Examples of org.apache.lucene.index.AtomicReaderContext.reader()

            lastDoc[0] = doc;
            try {
              if (scorer == null) {
                Weight w = s.createNormalizedWeight(q);
                AtomicReaderContext context = readerContextArray.get(leafPtr);
                scorer = w.scorer(context, true, false, context.reader().getLiveDocs());
              }
             
              int op = order[(opidx[0]++) % order.length];
              // System.out.println(op==skip_op ?
              // "skip("+(sdoc[0]+1)+")":"next()");
View Full Code Here

Examples of org.apache.lucene.index.AtomicReaderContext.reader()

              final AtomicReader previousReader = lastReader[0];
              IndexSearcher indexSearcher = LuceneTestCase.newSearcher(previousReader);
              indexSearcher.setSimilarity(s.getSimilarity());
              Weight w = indexSearcher.createNormalizedWeight(q);
              AtomicReaderContext ctx = (AtomicReaderContext)indexSearcher.getTopReaderContext();
              Scorer scorer = w.scorer(ctx, true, false, ctx.reader().getLiveDocs());
              if (scorer != null) {
                boolean more = scorer.advance(lastDoc[0] + 1) != DocIdSetIterator.NO_MORE_DOCS;
                Assert.assertFalse("query's last doc was "+ lastDoc[0] +" but skipTo("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
              }
              leafPtr++;
View Full Code Here

Examples of org.apache.lucene.index.AtomicReaderContext.reader()

          final AtomicReader previousReader = lastReader[0];
          IndexSearcher indexSearcher = LuceneTestCase.newSearcher(previousReader, false);
          indexSearcher.setSimilarity(s.getSimilarity());
          Weight w = indexSearcher.createNormalizedWeight(q);
          AtomicReaderContext ctx = previousReader.getContext();
          Scorer scorer = w.scorer(ctx, true, false, ctx.reader().getLiveDocs());
          if (scorer != null) {
            boolean more = scorer.advance(lastDoc[0] + 1) != DocIdSetIterator.NO_MORE_DOCS;
            Assert.assertFalse("query's last doc was "+ lastDoc[0] +" but skipTo("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
          }
        }
View Full Code Here

Examples of org.apache.lucene.index.AtomicReaderContext.reader()

    IndexReader reader = SlowCompositeReaderWrapper.wrap(w.getReader());
    assertTrue(reader.getContext() instanceof AtomicReaderContext);
    AtomicReaderContext context = (AtomicReaderContext) reader.getContext();
    w.close();

    DocIdSet idSet = termFilter(fieldName, "value1").getDocIdSet(context, context.reader().getLiveDocs());
    assertNotNull("must not be null", idSet);
    DocIdSetIterator iter = idSet.iterator();
    assertEquals(iter.nextDoc(), 0);
    assertEquals(iter.nextDoc(), DocIdSetIterator.NO_MORE_DOCS);
View Full Code Here

Examples of org.apache.lucene.index.AtomicReaderContext.reader()

    assertNotNull("must not be null", idSet);
    DocIdSetIterator iter = idSet.iterator();
    assertEquals(iter.nextDoc(), 0);
    assertEquals(iter.nextDoc(), DocIdSetIterator.NO_MORE_DOCS);

    idSet = termFilter(fieldName, "value2").getDocIdSet(context, context.reader().getLiveDocs());
    assertNull("must be null", idSet);

    idSet = termFilter("field2", "value1").getDocIdSet(context, context.reader().getLiveDocs());
    assertNull("must be null", idSet);
View Full Code Here

Examples of org.apache.lucene.index.AtomicReaderContext.reader()

    assertEquals(iter.nextDoc(), DocIdSetIterator.NO_MORE_DOCS);

    idSet = termFilter(fieldName, "value2").getDocIdSet(context, context.reader().getLiveDocs());
    assertNull("must be null", idSet);

    idSet = termFilter("field2", "value1").getDocIdSet(context, context.reader().getLiveDocs());
    assertNull("must be null", idSet);

    reader.close();
    rd.close();
  }
View Full Code Here

Examples of org.apache.lucene.index.AtomicReaderContext.reader()

  protected Scorer getScorer(final Query query) throws IOException {
    final Weight weight = searcher.createNormalizedWeight(query);
    assertTrue(searcher.getTopReaderContext() instanceof AtomicReaderContext);
    final AtomicReaderContext context = (AtomicReaderContext) searcher.getTopReaderContext();
    return weight.scorer(context, true, true, context.reader().getLiveDocs());
  }

  public static abstract class LuceneQueryBuilder {

    public abstract Query getQuery();
View Full Code Here

Examples of org.apache.lucene.index.AtomicReaderContext.reader()

      TreeSet<Term> extractedTerms = new TreeSet<Term>();
      q.extractTerms(extractedTerms);
      for (Term term : extractedTerms) {
        termContexts.put(term, TermContext.build(context, term));
      }
      Bits acceptDocs = context.reader().getLiveDocs();
      final Spans spans = q.getSpans(context, acceptDocs, termContexts);

      // collect span positions
      while (spans.next()) {
        spanPositions.add(new PositionSpan(spans.start(), spans.end() - 1));
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.