All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Search Query doesn't return results in an odd way with brackets in query

Sam Cosgrove 29 Aug 2019 10:14 problem, complete

I have an issue where my search form and setup all appeared to be working correctly until I began searching for a specific term.

Essentially, a section on the site contains a large amount of entries with the term BC(A)R in the title.

If I search any of the following terms: "b", "B", "bc", "BC", "bc(", "BC(", "bc(a", "BC(A", "bc(a)", or "BC(A)" then I will get the intended results.

However, as soon as I add the r, i.e. "bc(a)r", or "BC(A)R", I get no results whatsoever.

Here's my current results tag setup:


{exp:low_search:results query="{segment_4}" keywords:stem="yes" keywords:inflect="yes" keywords:mode="auto" keywords:loose="both"
collection="knowledge_centre" paginate="both" paginate_base="dashboard/resources/{segment_3}" show_future_entries="yes" show_expired="yes"}


I've also tried using a few different filter options but no joy so far.

I've also ensured that I've rebuilt the index and lexicon for my collection.

Any ideas on what may be going wrong?

Thanks in advance,
Sam

Replies

  1. Low 29 Aug 2019 12:58

    Can you enable the Template Debugger and copy/paste its contents (including queries generated by LS) here?

  2. Sam Cosgrove 29 Aug 2019 13:30

    Hi Low,

    I can, but I think I can see what may be happening now but don't know how to stop it.

    Low search or something I've done seems to be stripping out everything within the brackets in the search term, so if I search "bc(a)r" or "BC(A)R", it actually searches for "bc r", and I get results when I search for everything up to "bc(a)" or "BC(A)" because it strips that to "bc" which will return results.

    I've also checked what gets passed in from my search form after being base64 encoded, and it just uses the verbatim text that was typed in.

    I've pasted the debugger contents here: https://pste.eu/p/E6Q3.html

    Thanks,
    Sam

  3. Low 29 Aug 2019 13:40

    Try using keywords:mode="all" and keywords:loose="right" and see if that helps.

  4. Sam Cosgrove 29 Aug 2019 13:46

    That's what I was using initially and then I began playing with those parameters in an attempt to change it.

    It doesn't work with those settings either, here's the debugger contents this time: https://pste.eu/p/adrP.html

  5. Low 29 Aug 2019 13:55

    Ah, any non-alphanumeric characters are removed, and then all ignore words are removed from the keywords as well. This includes the word 'a' by default. You can try and remove that word from the Ignore Words list in the LS settings.

  6. Sam Cosgrove 29 Aug 2019 14:03

    That's it exactly and that makes sense.

    I removed the 'a' from the ignore words and that resolved my issue immediately.

    Thank you very much for your help and swift responses.