Examples of TotalHitsRef


Examples of org.apache.blur.lucene.search.IterablePaging.TotalHitsRef

  public static void main(String[] args) throws Exception {
    IndexReader reader = getReaderFlatScore(13245);
    IndexSearcher searcher = new IndexSearcher(reader);

    TotalHitsRef totalHitsRef = new TotalHitsRef();
    ProgressRef progressRef = new ProgressRef();

    TermQuery query = new TermQuery(new Term("f1", "value"));
    IterablePaging paging = new IterablePaging(new AtomicBoolean(true), searcher, query, 100, null, null, false);
    IterablePaging itPaging = paging.skipTo(90).gather(20).totalHits(totalHitsRef).progress(progressRef);
    BlurIterator<ScoreDoc, BlurException> iterator = itPaging.iterator();
    while (iterator.hasNext()) {
      ScoreDoc sd = iterator.next();
      System.out.println("time [" + progressRef.queryTime() + "] " + "total hits [" + totalHitsRef.totalHits() + "] "
          + "searches [" + progressRef.searchesPerformed() + "] " + "position [" + progressRef.currentHitPosition()
          + "] " + "doc id [" + sd.doc + "] " + "score [" + sd.score + "]");
    }
  }
View Full Code Here

Examples of org.apache.blur.lucene.search.IterablePaging.TotalHitsRef

  @Test
  public void testSimpleSearchPaging() throws Exception {
    IndexReader reader = getReaderFlatScore(13245);
    IndexSearcher searcher = new IndexSearcher(reader);

    TotalHitsRef totalHitsRef = new TotalHitsRef();
    ProgressRef progressRef = new ProgressRef();

    TermQuery query = new TermQuery(new Term("f1", "value"));
    IterablePaging paging = new IterablePaging(new AtomicBoolean(true), searcher, query, 100, null, null, false, null,
        new DeepPagingCache());
    IterablePaging itPaging = paging.skipTo(90).gather(20).totalHits(totalHitsRef).progress(progressRef);
    BlurIterator<ScoreDoc, BlurException> iterator = itPaging.iterator();
    int position = 90;
    int searches = 1;
    while (iterator.hasNext()) {
      ScoreDoc sd = iterator.next();
      assertEquals(position, progressRef.currentHitPosition());
      assertEquals(searches, progressRef.searchesPerformed());
      System.out.println("time [" + progressRef.queryTime() + "] " + "total hits [" + totalHitsRef.totalHits() + "] "
          + "searches [" + progressRef.searchesPerformed() + "] " + "position [" + progressRef.currentHitPosition()
          + "] " + "doc id [" + sd.doc + "] " + "score [" + sd.score + "]");
      position++;
      if (position == 100) {
        searches++;
View Full Code Here

Examples of org.apache.blur.lucene.search.IterablePaging.TotalHitsRef

  public void testSimpleSearchPagingThroughAll() throws Exception {
    int length = 13245;
    IndexReader reader = getReaderFlatScore(length);
    IndexSearcher searcher = new IndexSearcher(reader);

    TotalHitsRef totalHitsRef = new TotalHitsRef();
    ProgressRef progressRef = new ProgressRef();

    long start = System.nanoTime();
    int position = 0;
    DeepPagingCache deepPagingCache = new DeepPagingCache(10);
    OUTER: while (true) {
      MatchAllDocsQuery query = new MatchAllDocsQuery();
      IterablePaging paging = new IterablePaging(new AtomicBoolean(true), searcher, query, 100, null, null, false,
          null, deepPagingCache);
      IterablePaging itPaging = paging.skipTo(position).totalHits(totalHitsRef).progress(progressRef);
      BlurIterator<ScoreDoc, BlurException> iterator = itPaging.iterator();

      while (iterator.hasNext()) {
        ScoreDoc sd = iterator.next();
        assertEquals(position, progressRef.currentHitPosition());
        System.out.println("time [" + progressRef.queryTime() + "] " + "total hits [" + totalHitsRef.totalHits() + "] "
            + "searches [" + progressRef.searchesPerformed() + "] " + "position [" + progressRef.currentHitPosition()
            + "] " + "doc id [" + sd.doc + "] " + "score [" + sd.score + "]");
        position++;
        if (position % 100 == 0) {
          continue OUTER;
View Full Code Here

Examples of org.apache.blur.lucene.search.IterablePaging.TotalHitsRef

  @Test
  public void testSimpleSearchPagingWithSorting() throws Exception {
    IndexReader reader = getReaderFlatScore(13245);
    IndexSearcher searcher = new IndexSearcher(reader);

    TotalHitsRef totalHitsRef = new TotalHitsRef();
    ProgressRef progressRef = new ProgressRef();

    printHeapSize();
    TermQuery query = new TermQuery(new Term("f1", "value"));
    Sort sort = new Sort(new SortField("index", Type.INT, true));
    IterablePaging paging = new IterablePaging(new AtomicBoolean(true), searcher, query, 100, null, null, false, sort,
        new DeepPagingCache());
    IterablePaging itPaging = paging.skipTo(90).gather(20).totalHits(totalHitsRef).progress(progressRef);
    BlurIterator<ScoreDoc, BlurException> iterator = itPaging.iterator();
    int position = 90;
    int searches = 1;
    while (iterator.hasNext()) {
      ScoreDoc sd = iterator.next();
      assertEquals(position, progressRef.currentHitPosition());
      assertEquals(searches, progressRef.searchesPerformed());
      System.out.println("time [" + progressRef.queryTime() + "] " + "total hits [" + totalHitsRef.totalHits() + "] "
          + "searches [" + progressRef.searchesPerformed() + "] " + "position [" + progressRef.currentHitPosition()
          + "] " + "doc id [" + sd.doc + "] " + "score [" + sd.score + "]");
      position++;
      if (position == 100) {
        searches++;
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.