Mercurial Hosting > luan
diff src/goodjava/lucene/queryparser/GoodQueryParser.java @ 1619:83caee2ed4ad
Lucene.escape
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 25 Jul 2021 18:50:14 -0600 |
parents | 45e42f403fb3 |
children | a9591906e608 |
line wrap: on
line diff
--- a/src/goodjava/lucene/queryparser/GoodQueryParser.java Mon Jun 14 18:45:17 2021 -0600 +++ b/src/goodjava/lucene/queryparser/GoodQueryParser.java Sun Jul 25 18:50:14 2021 -0600 @@ -19,7 +19,7 @@ return new GoodQueryParser(fieldParser,query).parseQuery(); } - public static String quote(String s) { + public static String escape(String s) { s = s.replace("\\","\\\\"); s = s.replace("\b","\\b"); s = s.replace("\f","\\f"); @@ -27,7 +27,7 @@ s = s.replace("\r","\\r"); s = s.replace("\t","\\t"); s = s.replace("\"","\\\""); - return "\""+s+"\""; + return s; } public static Sort parseSort(FieldParser fieldParser,String sort) throws ParseException { @@ -194,7 +194,7 @@ String match = Unquoted(NOT_IN_FIELD); if( match.length()==0 ) return parser.failure((String)null); - match = StringFieldParser.escape(this,match); + match = StringFieldParser.unescape(this,match); return parser.success(match); }