Package org.dlese.dpc.index.queryParser
Class XMLQueryParser
java.lang.Object
org.dlese.dpc.index.queryParser.XMLQueryParser
Creates a Lucene Query from an XML representation of a query. See sample Query XML file . Currently
supports term, phrase, boolean and Lucene query syntax formatted queries, with option to set the boost
factor assigned to any query (default boost is 1.0). If a Lucene query syntax based query may be found in
the Query XML, then a Lucene QueryParser must be supplied, otherwise it may be ommitted.
- Author:
- John Weatherley
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.lucene.search.QuerygetLuceneQuery(File queryXml, org.apache.lucene.queryParser.QueryParser queryParser) Gets the Lucene Query representation for the given XML Query.static org.apache.lucene.search.QuerygetLuceneQuery(String queryXml, org.apache.lucene.queryParser.QueryParser queryParser) Gets the Lucene Query representation for the given XML Query.static org.apache.lucene.search.QuerygetLuceneQuery(URL queryXml, org.apache.lucene.queryParser.QueryParser queryParser) Gets the Lucene Query representation for the given XML Query.static org.apache.lucene.search.QuerygetLuceneQuery(org.dom4j.Element queryElement, org.apache.lucene.queryParser.QueryParser queryParser) Gets the Lucene Query representation for the given XML Query starting at the Query element.static StringgetQueryString(String queryXml, org.apache.lucene.queryParser.QueryParser queryParser) Gets the Lucene query String representation for the given XML Query.
-
Constructor Details
-
XMLQueryParser
public XMLQueryParser()
-
-
Method Details
-
getQueryString
public static String getQueryString(String queryXml, org.apache.lucene.queryParser.QueryParser queryParser) throws Exception Gets the Lucene query String representation for the given XML Query.- Parameters:
queryXml- A XML QueryqueryParser- QueryParser used to parse Lucene syntax based queries and tokenize the text- Returns:
- The queryString value
- Throws:
Exception- If error
-
getLuceneQuery
public static org.apache.lucene.search.Query getLuceneQuery(File queryXml, org.apache.lucene.queryParser.QueryParser queryParser) throws Exception Gets the Lucene Query representation for the given XML Query.- Parameters:
queryXml- A file containing an XML QueryqueryParser- QueryParser used to parse Lucene syntax based queries and tokenize the text- Returns:
- The Lucene Query object representation of this XML Query
- Throws:
Exception- If error
-
getLuceneQuery
public static org.apache.lucene.search.Query getLuceneQuery(URL queryXml, org.apache.lucene.queryParser.QueryParser queryParser) throws Exception Gets the Lucene Query representation for the given XML Query.- Parameters:
queryXml- A URL to a file containing an XML QueryqueryParser- QueryParser used to parse Lucene syntax based queries and tokenize the text- Returns:
- The Lucene Query object representation of this XML Query
- Throws:
Exception- If error
-
getLuceneQuery
public static org.apache.lucene.search.Query getLuceneQuery(String queryXml, org.apache.lucene.queryParser.QueryParser queryParser) throws Exception Gets the Lucene Query representation for the given XML Query.- Parameters:
queryXml- An XML QueryqueryParser- QueryParser used to parse Lucene syntax based queries and tokenize the text- Returns:
- The Lucene Query object representation of this XML Query
- Throws:
Exception- If error
-
getLuceneQuery
public static org.apache.lucene.search.Query getLuceneQuery(org.dom4j.Element queryElement, org.apache.lucene.queryParser.QueryParser queryParser) throws Exception Gets the Lucene Query representation for the given XML Query starting at the Query element.- Parameters:
queryElement- A dom4j representation of the Query elementqueryParser- QueryParser used to parse Lucene syntax based queries and tokenize the text- Returns:
- The Lucene Query object representation of this XML Query
- Throws:
Exception- If error
-