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

Support archive

Search keywords with asterisk

ngoncom 19 Oct 2017 22:01 question, complete

Hi,

I am in trouble with search keywords that have asterisk (*) inside, I have some case:

- keywords = 090* will results: 0901555, 0902555...
- keywords = 090*333 will results: 09011333, 090 2555 333...
- keywords = *333 will results: 999333, 888333...

I put keywords:mode="auto" in results tag but not working.

Thank for help!

Replies

  1. Low 20 Oct 2017 12:34

    When using keywords:mode="auto", then an asterisk is considered a wildcard. So that's actually intended behaviour.

    Try using keywords:mode="exact" instead.

    Note that the Keywords filter will sanitize all given keywords; it will strip out any non-word characters (including the asterisk), like it does with its collection indexes. If you need to search for punctuation and such, try using the Field Search filter instead.

  2. ngoncom 20 Oct 2017 16:48

    My problem has been resolved, thank so much!

    Here is my testing with "my_number" is a custom field that contain a number only, ex:

    entry 1, my_number = 123456789
    entry 2, my_number = 777777777
    entry 3, my_number = 888888888
    entry 4, my_number = 999001111
    entry 5, my_number = 999002111

    Here is my results tag for test:

    {exp:low_search:results search:my_number="^123" ...

    Well, I search start with 123 and it return entry 1

    {exp:low_search:results search:my_number="777$" ...

    Well, I search end with 777 and it return entry 2

    {exp:low_search:results search:my_number="888" ...

    Well, I search contain string 888 and it return entry 3

    And the last case, I think it is feature request (search with wildcard or keywords support regex). I want to search with keywords contain wildcard "999*0*111" to return entry 4, entry 5.

    With me, Low search not only a form search, it help preprocessing data, so that I can list entries as the ways I like. It is powerful!