anl.aida.client.search
Class LuceneSearcher

java.lang.Object
  extended by anl.aida.client.search.LuceneSearcher

public class LuceneSearcher
extends java.lang.Object

Searches a Lucene index and returning results as DocumentIDs.


Field Summary
private  org.apache.lucene.search.IndexSearcher searcher
           
private  anl.aida.core.ScoredTermsCollection stc
           
 
Constructor Summary
LuceneSearcher(java.lang.String index, anl.aida.core.ScoredTermsCollection stc)
           
 
Method Summary
 void close()
          Closes the searcher.
private  anl.aida.core.DocumentID findDocument(java.lang.String path)
           
 java.util.List<anl.aida.core.DocumentID> search(java.util.List<anl.aida.core.DocumentID> ids, java.lang.String queryString, int numDocs)
          Searches the index using the specified query, returning no more than numDocs results.
 java.util.List<anl.aida.core.DocumentID> search(java.lang.String queryString, int numDocs)
          Searches the index using the specified query, returning no more than numDocs results.
 java.util.List<anl.aida.core.DocumentID> search(java.lang.String queryString, int numDocs, org.apache.lucene.search.Filter filter)
          Searches the index using the specified query, returning no more than numDocs results.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stc

private anl.aida.core.ScoredTermsCollection stc

searcher

private org.apache.lucene.search.IndexSearcher searcher
Constructor Detail

LuceneSearcher

public LuceneSearcher(java.lang.String index,
                      anl.aida.core.ScoredTermsCollection stc)
               throws java.io.IOException
Throws:
java.io.IOException
Method Detail

search

public java.util.List<anl.aida.core.DocumentID> search(java.util.List<anl.aida.core.DocumentID> ids,
                                                       java.lang.String queryString,
                                                       int numDocs)
                                                throws org.apache.lucene.queryParser.ParseException,
                                                       java.io.IOException
Searches the index using the specified query, returning no more than numDocs results. The results are limited to those docs specified in ids.

Parameters:
ids - any result must be part of this list of document ids
queryString - the query
numDocs - the maximum number of docs to return
Returns:
an index of document ids for the docs returned by the search
Throws:
org.apache.lucene.queryParser.ParseException - if there is an error in the query
java.io.IOException - if there is an error searching the index

search

public java.util.List<anl.aida.core.DocumentID> search(java.lang.String queryString,
                                                       int numDocs)
                                                throws org.apache.lucene.queryParser.ParseException,
                                                       java.io.IOException
Searches the index using the specified query, returning no more than numDocs results.

Parameters:
queryString - the query
numDocs - the maximum number of docs to return
Returns:
an index of document ids for the docs returned by the search
Throws:
org.apache.lucene.queryParser.ParseException - if there is an error in the query
java.io.IOException - if there is an error searching the index

search

public java.util.List<anl.aida.core.DocumentID> search(java.lang.String queryString,
                                                       int numDocs,
                                                       org.apache.lucene.search.Filter filter)
                                                throws org.apache.lucene.queryParser.ParseException,
                                                       java.io.IOException
Searches the index using the specified query, returning no more than numDocs results.

Parameters:
queryString - the query
numDocs - the maximum number of docs to return
filter - the filter to filter query results. This can be null.
Returns:
an index of document ids for the docs returned by the search
Throws:
org.apache.lucene.queryParser.ParseException - if there is an error in the query
java.io.IOException - if there is an error searching the index

close

public void close()
           throws java.io.IOException
Closes the searcher. It cannot be used after this has been called

Throws:
java.io.IOException - if there is an error closing the searcher.

findDocument

private anl.aida.core.DocumentID findDocument(java.lang.String path)