comparison src/goodjava/queryparser/NumberFieldParser.java @ 1433:5f038be65271

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 24 Dec 2019 17:57:47 -0700
parents 27efb1fcbcb5
children f6075d7a36f2
comparison
equal deleted inserted replaced
1432:d7644b21b128 1433:5f038be65271
1 package goodjava.queryparser; 1 package goodjava.queryparser;
2 2
3 import org.apache.lucene.search.Query; 3 import org.apache.lucene.search.Query;
4 import org.apache.lucene.search.NumericRangeQuery; 4 import org.apache.lucene.search.NumericRangeQuery;
5 import org.apache.lucene.search.SortField; 5 import org.apache.lucene.search.SortField;
6 import org.apache.lucene.search.PrefixQuery;
7 import org.apache.lucene.index.Term;
6 import goodjava.parser.ParseException; 8 import goodjava.parser.ParseException;
7 9
8 10
9 public abstract class NumberFieldParser implements FieldParser { 11 public abstract class NumberFieldParser implements FieldParser {
10 12
11 @Override public final Query getQuery(SaneQueryParser qp,String field,String query) throws ParseException { 13 @Override public final Query getQuery(SaneQueryParser qp,String field,String query) throws ParseException {
14 if( query.equals("*") )
15 return new PrefixQuery(new Term(field,""));
12 return getRangeQuery(qp,field,query,query,true,true); 16 return getRangeQuery(qp,field,query,query,true,true);
13 } 17 }
14 18
15 @Override public final Query getRangeQuery(SaneQueryParser qp,String field,String minQuery,String maxQuery,boolean includeMin,boolean includeMax) throws ParseException { 19 @Override public final Query getRangeQuery(SaneQueryParser qp,String field,String minQuery,String maxQuery,boolean includeMin,boolean includeMax) throws ParseException {
16 try { 20 try {