Search in sources :

Example 6 with ParserException

use of org.apache.lucene.queryparser.xml.ParserException in project lucene-solr by apache.

the class TestLegacyNumericRangeQueryBuilder method testGetFilterHandleNumericParseErrorStrict.

public void testGetFilterHandleNumericParseErrorStrict() throws Exception {
    LegacyNumericRangeQueryBuilder filterBuilder = new LegacyNumericRangeQueryBuilder();
    String xml = "<LegacyNumericRangeQuery fieldName='AGE' type='int' lowerTerm='-1' upperTerm='NaN'/>";
    Document doc = getDocumentFromString(xml);
    try {
        filterBuilder.getQuery(doc.getDocumentElement());
    } catch (ParserException e) {
        return;
    }
    fail("Expected to throw " + ParserException.class);
}
Also used : ParserException(org.apache.lucene.queryparser.xml.ParserException) Document(org.w3c.dom.Document)

Aggregations

ParserException (org.apache.lucene.queryparser.xml.ParserException)6 Query (org.apache.lucene.search.Query)3 IOException (java.io.IOException)2 TokenStream (org.apache.lucene.analysis.TokenStream)2 BoostQuery (org.apache.lucene.search.BoostQuery)2 ArrayList (java.util.ArrayList)1 CharTermAttribute (org.apache.lucene.analysis.tokenattributes.CharTermAttribute)1 TermToBytesRefAttribute (org.apache.lucene.analysis.tokenattributes.TermToBytesRefAttribute)1 Term (org.apache.lucene.index.Term)1 MoreLikeThisQuery (org.apache.lucene.queries.mlt.MoreLikeThisQuery)1 ParseException (org.apache.lucene.queryparser.classic.ParseException)1 QueryParser (org.apache.lucene.queryparser.classic.QueryParser)1 SpanBoostQuery (org.apache.lucene.search.spans.SpanBoostQuery)1 SpanOrQuery (org.apache.lucene.search.spans.SpanOrQuery)1 SpanQuery (org.apache.lucene.search.spans.SpanQuery)1 SpanTermQuery (org.apache.lucene.search.spans.SpanTermQuery)1 LegacyNumericRangeQuery (org.apache.solr.legacy.LegacyNumericRangeQuery)1 Document (org.w3c.dom.Document)1