gate.creole.annic.lucene
Class LuceneSearchThread

java.lang.Object
  extended by gate.creole.annic.lucene.LuceneSearchThread

public class LuceneSearchThread
extends Object

Given a boolean query, it is translated into one or more AND normalized queries. For example: (A|B)C is translated into AC and BC. For each such query an instance of LuceneSearchThread is created. Here, each query is issued separately and results are submitted to main instance of LuceneSearch.

Author:
niraj

Field Summary
 boolean finished
          Indicates if searching process is finished.
 
Constructor Summary
LuceneSearchThread()
           
 
Method Summary
 String getQuery()
          Gets the query.
 List<Pattern> next(int numberOfResults)
          This method returns a list containing instances of Pattern
 boolean search(String query, int patternWindow, String indexLocation, String corpusToSearchIn, String annotationSetToSearchIn, LuceneSearcher luceneSearcher)
          This method collects the necessary information from lucene and uses it when the next method is called
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

finished

public boolean finished
Indicates if searching process is finished.

Constructor Detail

LuceneSearchThread

public LuceneSearchThread()
Method Detail

search

public boolean search(String query,
                      int patternWindow,
                      String indexLocation,
                      String corpusToSearchIn,
                      String annotationSetToSearchIn,
                      LuceneSearcher luceneSearcher)
               throws SearchException
This method collects the necessary information from lucene and uses it when the next method is called

Parameters:
query - query supplied by the user
patternWindow - number of tokens to refer on left and right context
indexLocation - location of the index the searcher should search in
luceneSearcher - an instance of lucene search from where the instance of SearchThread is invoked
Returns:
true iff search was successful false otherwise
Throws:
SearchException

next

public List<Pattern> next(int numberOfResults)
                   throws Exception
This method returns a list containing instances of Pattern

Parameters:
numberOfResults - the number of results to fetch
Returns:
a list of QueryResult
Throws:
Exception

getQuery

public String getQuery()
Gets the query.