Package org.apache.lucene.index

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


    NumericRangeFilter<Long> f = NumericRangeFilter.newLongRange("field8", 8, 1000L, -1000L, true, true);
    assertNull("A inverse range should return the null instance",
        f.getDocIdSet(context, context.reader().getLiveDocs()));
    f = NumericRangeFilter.newLongRange("field8", 8, Long.MAX_VALUE, null, false, false);
    assertNull("A exclusive range starting with Long.MAX_VALUE should return the null instance",
               f.getDocIdSet(context, context.reader().getLiveDocs()));
    f = NumericRangeFilter.newLongRange("field8", 8, null, Long.MIN_VALUE, false, false);
    assertNull("A exclusive range ending with Long.MIN_VALUE should return the null instance",
               f.getDocIdSet(context, context.reader().getLiveDocs()));
  }
 
View Full Code Here


    f = NumericRangeFilter.newLongRange("field8", 8, Long.MAX_VALUE, null, false, false);
    assertNull("A exclusive range starting with Long.MAX_VALUE should return the null instance",
               f.getDocIdSet(context, context.reader().getLiveDocs()));
    f = NumericRangeFilter.newLongRange("field8", 8, null, Long.MIN_VALUE, false, false);
    assertNull("A exclusive range ending with Long.MIN_VALUE should return the null instance",
               f.getDocIdSet(context, context.reader().getLiveDocs()));
  }
 
  @Test
  public void testOneMatchQuery() throws Exception {
    NumericRangeQuery<Long> q = NumericRangeQuery.newLongRange("ascfield8", 8, 1000L, 1000L, true, true);
View Full Code Here

    TermQuery termQuery = new TermQuery(allTerm);
   
    Weight weight = indexSearcher.createNormalizedWeight(termQuery);
    assertTrue(indexSearcher.getTopReaderContext() instanceof AtomicReaderContext);
    AtomicReaderContext context = (AtomicReaderContext)indexSearcher.getTopReaderContext();
    Scorer ts = weight.scorer(context, true, true, context.reader().getLiveDocs());
    // we have 2 documents with the term all in them, one document for all the
    // other values
    final List<TestHit> docs = new ArrayList<TestHit>();
    // must call next first
   
View Full Code Here

    TermQuery termQuery = new TermQuery(allTerm);
   
    Weight weight = indexSearcher.createNormalizedWeight(termQuery);
    assertTrue(indexSearcher.getTopReaderContext() instanceof AtomicReaderContext);
    AtomicReaderContext context = (AtomicReaderContext) indexSearcher.getTopReaderContext();
    Scorer ts = weight.scorer(context, true, false, context.reader().getLiveDocs());
    assertTrue("next did not return a doc",
        ts.nextDoc() != DocIdSetIterator.NO_MORE_DOCS);
    assertTrue("score is not correct", ts.score() == 1.6931472f);
    assertTrue("next did not return a doc",
        ts.nextDoc() != DocIdSetIterator.NO_MORE_DOCS);
View Full Code Here

    TermQuery termQuery = new TermQuery(allTerm);
   
    Weight weight = indexSearcher.createNormalizedWeight(termQuery);
    assertTrue(indexSearcher.getTopReaderContext() instanceof AtomicReaderContext);
    AtomicReaderContext context = (AtomicReaderContext) indexSearcher.getTopReaderContext();
    Scorer ts = weight.scorer(context, true, false, context.reader().getLiveDocs());
    assertTrue("Didn't skip", ts.advance(3) != DocIdSetIterator.NO_MORE_DOCS);
    // The next doc should be doc 5
    assertTrue("doc should be number 5", ts.docID() == 5);
  }
 
View Full Code Here

      termContexts.put(term, TermContext.build(topLevelReaderContext, term));
    }
    final List<AtomicReaderContext> leaves = topLevelReaderContext.leaves();
    if(leaves.size() == 1) {
      final AtomicReaderContext ctx = leaves.get(0);
      return query.getSpans(ctx, ctx.reader().getLiveDocs(), termContexts);
    }
    return new MultiSpansWrapper(leaves, query, termContexts);
  }

  @Override
View Full Code Here

    if (leafOrd >= numLeaves) {
      return false;
    }
    if (current == null) {
      final AtomicReaderContext ctx = leaves.get(leafOrd);
      current = query.getSpans(ctx, ctx.reader().getLiveDocs(), termContexts);
    }
    while(true) {
      if (current.next()) {
        return true;
      }
View Full Code Here

      if (current.next()) {
        return true;
      }
      if (++leafOrd < numLeaves) {
        final AtomicReaderContext ctx = leaves.get(leafOrd);
        current = query.getSpans(ctx, ctx.reader().getLiveDocs(), termContexts);
      } else {
        current = null;
        break;
      }
    }
View Full Code Here

    int subIndex = ReaderUtil.subIndex(target, leaves);
    assert subIndex >= leafOrd;
    if (subIndex != leafOrd) {
      final AtomicReaderContext ctx = leaves.get(subIndex);
      current = query.getSpans(ctx, ctx.reader().getLiveDocs(), termContexts);
      leafOrd = subIndex;
    } else if (current == null) {
      final AtomicReaderContext ctx = leaves.get(leafOrd);
      current = query.getSpans(ctx, ctx.reader().getLiveDocs(), termContexts);
    }
View Full Code Here

      final AtomicReaderContext ctx = leaves.get(subIndex);
      current = query.getSpans(ctx, ctx.reader().getLiveDocs(), termContexts);
      leafOrd = subIndex;
    } else if (current == null) {
      final AtomicReaderContext ctx = leaves.get(leafOrd);
      current = query.getSpans(ctx, ctx.reader().getLiveDocs(), termContexts);
    }
    while (true) {
      if (target < leaves.get(leafOrd).docBase) {
        // target was in the previous slice
        if (current.next()) {
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.