org.apache.jackrabbit.core.query.lucene
Class SortedLuceneQueryHits

java.lang.Object
  extended by org.apache.jackrabbit.core.query.lucene.AbstractQueryHits
      extended by org.apache.jackrabbit.core.query.lucene.SortedLuceneQueryHits
All Implemented Interfaces:
CloseableHits, QueryHits

public final class SortedLuceneQueryHits
extends AbstractQueryHits

Wraps a lucene query result and adds a close method that allows to release resources after a query has been executed and the results have been read completely.


Constructor Summary
SortedLuceneQueryHits(org.apache.lucene.index.IndexReader reader, JackrabbitIndexSearcher searcher, org.apache.lucene.search.Query query, org.apache.lucene.search.Sort sort, long resultFetchHint)
          Creates a new QueryHits instance wrapping hits.
 
Method Summary
 int getSize()
          This default implementation returns -1.
 ScoreNode nextScoreNode()
          Returns the next score node in this QueryHits or null if there are no more score nodes.
 void skip(int n)
          Skips n hits.
 
Methods inherited from class org.apache.jackrabbit.core.query.lucene.AbstractQueryHits
close
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SortedLuceneQueryHits

public SortedLuceneQueryHits(org.apache.lucene.index.IndexReader reader,
                             JackrabbitIndexSearcher searcher,
                             org.apache.lucene.search.Query query,
                             org.apache.lucene.search.Sort sort,
                             long resultFetchHint)
                      throws IOException
Creates a new QueryHits instance wrapping hits.

Parameters:
reader - the IndexReader in use.
searcher - the index searcher.
query - the query to execute.
sort - the sort criteria.
resultFetchHint - a hint on how many results should be fetched.
Throws:
IOException - if an error occurs while reading from the index.
Method Detail

getSize

public int getSize()
This default implementation returns -1.

Specified by:
getSize in interface CloseableHits
Overrides:
getSize in class AbstractQueryHits
Returns:
-1.

nextScoreNode

public ScoreNode nextScoreNode()
                        throws IOException
Returns the next score node in this QueryHits or null if there are no more score nodes.

Returns:
the next score node in this QueryHits.
Throws:
IOException - if an error occurs while reading from the index.

skip

public void skip(int n)
          throws IOException
Skips n hits.

Specified by:
skip in interface CloseableHits
Overrides:
skip in class AbstractQueryHits
Parameters:
n - the number of hits to skip.
Throws:
IOException - if an error occurs while skipping.


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.