Looking through my httpd logs I see lots of searches as such

/devbox/search?q=%29%20AND%203318%3D4385%20AND%20%287778%3D7778

ie : ) AND 3318=4385 AND (7778=7778

guess they might be fishing for something.

For the fuzzy search I use a different distance values and the default is  ~0.6

String distance = "~0.6";

.........

bQueryF.add(queryParser.parse(QueryParser.escape(term)
                                        .replace("~", "") + distance),
                                BooleanClause.Occur.MUST);


From the query string above I get the error shown below.  I added QueryParser.escape(term) but maybe this does nothing here.  Is there a way to escape these or configure lecene just to return no results rather than an exception.

2024-08-11 09:19:05,427 ERROR me.search.operations.SearchMe SearchMe:doRun - Error searching index

org.apache.lucene.queryparser.classic.ParseException: Cannot parse 'AND~0.6': Encountered " <AND> "AND "" at line 1, column 0.

Was expecting one of:

<NOT> ...

"+" ...

"-" ...

<BAREOPER> ...

"(" ...

"*" ...

<QUOTED> ...

<TERM> ...

<PREFIXTERM> ...

<WILDTERM> ...

<REGEXPTERM> ...

"[" ...

"{" ...

<NUMBER> ...

<TERM> ...

at org.apache.lucene.queryparser.classic.QueryParserBase.parse(QueryParserBase.java:141) ~[lucene-queryparser-9.11.1.jar:9.11.1 0c087dfdd10e0f6f3f6faecc6af4415e671a9e69 - 2024-06-23 12:31:02]

at org.events.business.search.operations.SearchOperation.doRun(SearchOperation.java:202) [classes/:?]

at org.events.business.search.operations.ReadFromIndexOperation.run(ReadFromIndexOperation.java:29) [classes/:?]

at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]

at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]

Thanks

Reply via email to