gate.creole.annic.lucene
Class QueryParser

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

public class QueryParser
extends Object

QueryParser parses the provided ANNIC Query and converts it into the format understood to Lucene.

Author:
niraj

Field Summary
 int position
           
 
Constructor Summary
QueryParser()
          Constructor
 
Method Summary
 ArrayList[] createTerms(String elem)
           
 List<String> findTokens(String query)
          Given a query this method returns tokens.
 String getQueryString(int i)
          When user submits an ANNIC query, one or more instances of lucene queries are created and returned.
static boolean isValidQuery(String query)
          Returns true if the submitted query is valid.
static void main(String[] args)
           
 boolean needValidation()
           
 Query[] parse(String field, String query, String baseTokenAnnotationType, String corpusID, String annotationSetToSearchIn)
          Given a query, this method parses it to convert it into one or more lucene queries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

position

public int position
Constructor Detail

QueryParser

public QueryParser()
Constructor

Method Detail

main

public static void main(String[] args)

isValidQuery

public static boolean isValidQuery(String query)
Returns true if the submitted query is valid.

Parameters:
query -
Returns:

parse

public Query[] parse(String field,
                     String query,
                     String baseTokenAnnotationType,
                     String corpusID,
                     String annotationSetToSearchIn)
              throws SearchException
Given a query, this method parses it to convert it into one or more lucene queries.

Parameters:
field -
query -
baseTokenAnnotationType -
corpusID -
Returns:
Throws:
SearchException

getQueryString

public String getQueryString(int i)
When user submits an ANNIC query, one or more instances of lucene queries are created and returned. This method returns the string representation of the query at the given index.

Parameters:
i -
Returns:

findTokens

public List<String> findTokens(String query)
                        throws SearchException
Given a query this method returns tokens. Here token is an object of string.

Parameters:
query -
Returns:
Throws:
SearchException

createTerms

public ArrayList[] createTerms(String elem)
                        throws SearchException
Throws:
SearchException

needValidation

public boolean needValidation()