org.terrier.querying.parser
Class QueryParser
java.lang.Object
org.terrier.querying.parser.QueryParser
public class QueryParser
- extends java.lang.Object
Useful class to parse the query. (We should have had this class years ago).
This class replaces all replicated code about how to parse a String query into
a Query tree, and add it to a pre-existing search request. This is most often
called from Manager.newSearchRequest(String,String), although client code can
use this method when other forms of Manager.newSearchRequest() are used.
Note that this class throws QueryParserException when it gets upset.
- Since:
- 2.0
- Author:
- Craig Macdonald
Method Summary |
static Query |
parseQuery(java.lang.String query)
Parse the specified query. |
static void |
parseQuery(java.lang.String query,
SearchRequest srq)
Parse the query specified in String query, and use it for the specified search request. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
QueryParser
public QueryParser()
parseQuery
public static void parseQuery(java.lang.String query,
SearchRequest srq)
throws QueryParserException
- Parse the query specified in String query, and use it for the specified search request.
Under normal usage, called by newSearchRequest(String,String).
- Parameters:
query
- The string query to parsesrq
- The request object that the manager can use
- Throws:
QueryParserException
- when the query cannot be parsed- Since:
- 2.0
parseQuery
public static Query parseQuery(java.lang.String query)
throws QueryParserException
- Parse the specified query.
- Parameters:
query
- The string query to parse
- Throws:
QueryParserException
- when the query cannot be parsed- Since:
- 2.0
Terrier 3.5. Copyright © 2004-2011 University of Glasgow