If you search in intranet with elasticsearch just the string > OR or > AND Then Koha gives error: > Error: Unable to perform your search. Please try again. What I was expecting: no results found.
I am seeing: /cgi-bin/koha/catalogue/search.pl?q=OR No results found No results match your search for 'kw,wrdl: OR'. /cgi-bin/koha/catalogue/search.pl?q=AND No results found No results match your search for 'kw,wrdl: AND'.
(In reply to Jonathan Druart from comment #1) > I am seeing: > > /cgi-bin/koha/catalogue/search.pl?q=OR > No results found Which Elasticsearch version you are using and are you using koha-testing-docker? I created the koha-testing-docker with > docker-compose -f docker-compose.yml -f docker-compose.mariadb_latest.yml -f docker-compose.es6.yml -p koha up --force-recreate and then run > koha-elasticsearch --rebuild -d kohadev and then in systempreferences I changed searchengine to Elasticsearch. After that doing the AND or OR search it gives error.
Sorry, something wrong on my side, Zebra was set (I am not used to check that, I setup my ktd with ES). I do recreate the problem.
IMO we should keep this behaviour. The query has not a correct syntax and so it makes more sense to tell the user that there was an error than no results were found.
(In reply to Jonathan Druart from comment #4) > IMO we should keep this behaviour. The query has not a correct syntax and so > it makes more sense to tell the user that there was an error than no results > were found. In that case we should treat this as invalid query and notify the user along the lines "The search cannot be processed because of invalid usage of OR/AND." and don't don't even send the query to Elasticsearch. Now there is unhandled error coming from Elasticsearch which makes it then impossible to spot real system errors. This bug can also be triggered with "something OR". With this "something OR" case it might be more desirable to just search for "something" or then convert OR to lower case and search for "something or" ?
IMO it's not a good idea to parse the query for such problems before we sent it to ES. We should request ES and eventually provide feedback to the user about why their query might have been syntactically wrong.
(In reply to Jonathan Druart from comment #6) > IMO it's not a good idea to parse the query for such problems before we sent > it to ES. We should request ES and eventually provide feedback to the user > about why their query might have been syntactically wrong. Agreed. Putting too much query parsing into Koha has gotten us into trouble in the past.
(In reply to Jonathan Druart from comment #6) > IMO it's not a good idea to parse the query for such problems before we sent > it to ES. We should request ES and eventually provide feedback to the user > about why their query might have been syntactically wrong. I'm sure it's probably a duplicate but I've raised Bug 27139 about showing users that there has been a search query error. That being said... you can type gibberish into Google and Google will never tell you that you have a syntax error. (Although I just tried doing an "any of these words" advanced search in Google using "miniature OR" and it created a search query for "miniature OR OR" so even Google is a bit buggy / incorrectly documented when it comes to complex search.) (Typing '"urban keith" and "pickles"' into Google without the single quotes also gives different results to what I'd expect. I want to know about Urban Keith and not Keith Urban, although it seems that Google thinks I've made a typo.)