Mercurial Hosting > luan
diff src/goodjava/lucene/queryparser/GoodQueryParser.java @ 1622:b7f8418fb7ba
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 26 Jul 2021 11:51:56 -0600 |
parents | a9591906e608 |
children | d1e7564a9ce5 |
line wrap: on
line diff
--- a/src/goodjava/lucene/queryparser/GoodQueryParser.java Sun Jul 25 23:14:59 2021 -0600 +++ b/src/goodjava/lucene/queryparser/GoodQueryParser.java Mon Jul 26 11:51:56 2021 -0600 @@ -19,6 +19,17 @@ return new GoodQueryParser(fieldParser,query).parseQuery(); } + public static String quote(String s) { + s = s.replace("\\","\\\\"); + s = s.replace("\b","\\b"); + s = s.replace("\f","\\f"); + s = s.replace("\n","\\n"); + s = s.replace("\r","\\r"); + s = s.replace("\t","\\t"); + s = s.replace("\"","\\\""); + return '"'+s+'"'; + } + public static String escape(String s) { s = s.replace("\\","\\\\"); s = s.replace("\b","\\b");