gate.creole.annic.apache.lucene.search
Class Hits

java.lang.Object
  extended by gate.creole.annic.apache.lucene.search.Hits

public final class Hits
extends Object

A ranked list of documents, used to hold search results.


Field Summary
private  Filter filter
           
private  HitDoc first
           
private  Vector hitDocs
           
private  HitDoc last
           
private  int length
           
private  int maxDocs
           
private  int numDocs
           
private  Query query
           
private  Searcher searcher
           
private  Sort sort
           
 
Constructor Summary
Hits(Searcher s, Query q, Filter f)
           
Hits(Searcher s, Query q, Filter f, Sort o)
           
 
Method Summary
private  void addToFront(HitDoc hitDoc)
           
 Document doc(int n)
          Returns the stored fields of the nth document in this set.
private  void getMoreDocs(int min)
          Tries to add new documents to hitDocs.
private  HitDoc hitDoc(int n)
           
 int id(int n)
          Returns the id for the nth document in this set.
 int length()
          Returns the total number of hits available in this set.
private  void remove(HitDoc hitDoc)
           
 float score(int n)
          Returns the score for the nth document in this set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

query

private Query query

searcher

private Searcher searcher

filter

private Filter filter

sort

private Sort sort

length

private int length

hitDocs

private Vector hitDocs

first

private HitDoc first

last

private HitDoc last

numDocs

private int numDocs

maxDocs

private int maxDocs
Constructor Detail

Hits

Hits(Searcher s,
     Query q,
     Filter f)
throws IOException
Throws:
IOException

Hits

Hits(Searcher s,
     Query q,
     Filter f,
     Sort o)
throws IOException
Throws:
IOException
Method Detail

getMoreDocs

private final void getMoreDocs(int min)
                        throws IOException
Tries to add new documents to hitDocs. Ensures that the hit numbered min has been retrieved.

Throws:
IOException

length

public final int length()
Returns the total number of hits available in this set.


doc

public final Document doc(int n)
                   throws IOException
Returns the stored fields of the nth document in this set.

Documents are cached, so that repeated requests for the same element may return the same Document object.

Throws:
IOException

score

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

Throws:
IOException

id

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

Throws:
IOException

hitDoc

private final HitDoc hitDoc(int n)
                     throws IOException
Throws:
IOException

addToFront

private final void addToFront(HitDoc hitDoc)

remove

private final void remove(HitDoc hitDoc)