Thoughts on Search Syntax (Zebra but maybe Elasticsearch)
Hi all, I ran into a problem today where the search query 'Emperor penguin (Aptenodytes forsteri) foraging ecology' (without single quotes) was creating a "CCL parsing error" in Zebra. I had QueryAutoTruncate enabled so QueryWeightFields was automatically disabled. Solutions include: 1. Wrap the search query in double quotes a. "Emperor penguin (Aptenodytes forsteri) foraging ecology" 2. Escape the parentheses with a backslash a. Emperor penguin \(Aptenodytes forsteri\) foraging ecology 3. Turn off QueryAutoTruncate a. This lets the weighted query code thoroughly mangle the query which includes wrapping it in double quotes. b. Note though that this option also makes it so that a search wrapped in double quotes (like Solution 1) becomes a CCL parsing error I think many of us know that Koha's Zebra-based query building is terrible, but changing it obviously has consequences and we have so many different search preference permutations that it makes it difficult to regression test search changes. We could start showing users when they have searches with syntax errors. but then we all will probably start getting a lot of calls. Although I was thinking that when showing that there was a syntax error with their query, we could also provide a little "cheat sheet" with the basics of Zebra's CCL syntax. (Of course, that's really only relevant when we're passing queries straight through to Zebra and not butchering them first in Koha.) We could try to fix search, but then who has the time/money for that? Why fix something that is not (seemingly) broken? I am wondering what other people think. Personally, I'm thinking that we should not allow complex queries in the OPAC "Search" box. We treat that box (as we always should have) as the operand to the index chosen in the "Library catalogue" drop down list. However. that would be a breaking change for anyone that has bookmarked any OPAC searches with complex search queries. I suppose that we could create a new System Preference like "SimplifySearch" and just enable that for new Koha installations though. Maybe one day we could then remove that system preference and just make it "The Way". After all, I think that the *majority* of people are going to be performing fairly straight forward searches in the OPAC "Search" box. They're not going to be doing things like '(kw,phr,rtrn:"David writes verbose emails") OR ( (ti,phr,ext:"I think David's ideas have some merit") AND (su:Emails) )'. Relevant bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27088 https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27139 David Cook Software Engineer Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Australia Office: 02 9212 0899 Online: 02 8005 0595
participants (1)
-
dcook@prosentient.com.au