diff src/goodjava/lucene/queryparser/StringFieldParser.java @ 1619:83caee2ed4ad

Lucene.escape
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 25 Jul 2021 18:50:14 -0600
parents b04b8fc5f4f4
children
line wrap: on
line diff
--- a/src/goodjava/lucene/queryparser/StringFieldParser.java	Mon Jun 14 18:45:17 2021 -0600
+++ b/src/goodjava/lucene/queryparser/StringFieldParser.java	Sun Jul 25 18:50:14 2021 -0600
@@ -31,7 +31,7 @@
 			return new WildcardQuery(new Term(field,wildcard));
 		if( query.endsWith("*") && !query.endsWith("\\*") )
 			return new PrefixQuery(new Term(field,query.substring(0,query.length()-1)));
-		query = escape(qp,query);
+		query = unescape(qp,query);
 		PhraseQuery pq = new PhraseQuery();
 		try {
 			TokenStream ts = analyzer.tokenStream(field,new StringReader(query));
@@ -55,12 +55,12 @@
 	}
 
 	@Override public Query getRangeQuery(GoodQueryParser qp,String field,String minQuery,String maxQuery,boolean includeMin,boolean includeMax) throws ParseException {
-		minQuery = minQuery.equals("*") ? null : escape(qp,minQuery);
-		maxQuery = maxQuery.equals("*") ? null : escape(qp,maxQuery);
+		minQuery = minQuery.equals("*") ? null : unescape(qp,minQuery);
+		maxQuery = maxQuery.equals("*") ? null : unescape(qp,maxQuery);
 		return TermRangeQuery.newStringRange(field,minQuery,maxQuery,includeMin,includeMax);
 	}
 
-	static String escape(GoodQueryParser qp,String s) throws ParseException {
+	static String unescape(GoodQueryParser qp,String s) throws ParseException {
 		final char[] a = s.toCharArray();
 		int i, n;
 		if( a[0] == '"' ) {