Mercurial Hosting > luan
comparison src/goodjava/queryparser/StringFieldParser.java @ 1445:f6075d7a36f2
better range query
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 05 Feb 2020 18:06:26 -0700 |
parents | 27efb1fcbcb5 |
children |
comparison
equal
deleted
inserted
replaced
1444:b765f146f4dc | 1445:f6075d7a36f2 |
---|---|
53 return new TermQuery(terms[0]); | 53 return new TermQuery(terms[0]); |
54 return pq; | 54 return pq; |
55 } | 55 } |
56 | 56 |
57 @Override public Query getRangeQuery(SaneQueryParser qp,String field,String minQuery,String maxQuery,boolean includeMin,boolean includeMax) throws ParseException { | 57 @Override public Query getRangeQuery(SaneQueryParser qp,String field,String minQuery,String maxQuery,boolean includeMin,boolean includeMax) throws ParseException { |
58 minQuery = escape(qp,minQuery); | 58 minQuery = minQuery.equals("*") ? null : escape(qp,minQuery); |
59 maxQuery = escape(qp,maxQuery); | 59 maxQuery = maxQuery.equals("*") ? null : escape(qp,maxQuery); |
60 return TermRangeQuery.newStringRange(field,minQuery,maxQuery,includeMin,includeMax); | 60 return TermRangeQuery.newStringRange(field,minQuery,maxQuery,includeMin,includeMax); |
61 } | 61 } |
62 | 62 |
63 static String escape(SaneQueryParser qp,String s) throws ParseException { | 63 static String escape(SaneQueryParser qp,String s) throws ParseException { |
64 final char[] a = s.toCharArray(); | 64 final char[] a = s.toCharArray(); |