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

java.lang.Object
  extended byorg.apache.jackrabbit.core.query.lucene.QueryHits

public class QueryHits
extends Object

Wraps the lucene Hits object 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
QueryHits(org.apache.lucene.search.Hits hits, org.apache.lucene.index.IndexReader reader)
          Creates a new QueryHits instance wrapping hits.
 
Method Summary
 void close()
          Releases resources held by this hits instance.
 org.apache.lucene.document.Document doc(int n)
          Returns the nth document in this QueryHits.
 int id(int n)
          Returns the document number for the nth document in this QueryHits.
 int length()
          Returns the number of results.
 float score(int n)
          Returns the score for the nth document in this QueryHits.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryHits

public QueryHits(org.apache.lucene.search.Hits hits,
                 org.apache.lucene.index.IndexReader reader)
Creates a new QueryHits instance wrapping hits.

Parameters:
hits - the lucene hits.
reader - the IndexReader in use by hits.
Method Detail

close

public final void close()
                 throws IOException
Releases resources held by this hits instance.

Throws:
IOException - if an error occurs while releasing resources.

length

public final int length()
Returns the number of results.

Returns:
the number of results.

doc

public final org.apache.lucene.document.Document doc(int n)
                                              throws IOException
Returns the nth document in this QueryHits.

Parameters:
n - index.
Returns:
the nth document in this QueryHits.
Throws:
IOException - if an error occurs while reading from the index.

score

public final float score(int n)
                  throws IOException
Returns the score for the nth document in this QueryHits.

Parameters:
n - index.
Returns:
the score for the nth document.
Throws:
IOException

id

public final int id(int n)
             throws IOException
Returns the document number for the nth document in this QueryHits.

Parameters:
n - index.
Returns:
the document number for the nth document.
Throws:
IOException - if an error occurs.


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