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

Support archive

Trouble with custom field and keywords:match

Jason Skinner 15 Feb 2016 02:11 question, complete

We are having problems implementing keywords:match in our results for custom field called eq_model. This field includes makes of agriculture equipment that range from "320" to "R4030".

When I search for "R4030", the results return as expected. I have set the ft_min_word_len to 3 in mysql and the settings. No luck.

We are also filtering by eq_make (make of the equipment), eq_year (year model) and so on. The only issue we are having is with the keyword search matching the eq_model field if it matches to the top of the search results. This is important for usability.

I have read through most of the topics here and am at a loss. I can give you access to the site, yet will have to email it to you, as it is a dev site.



SAMPLE

 
{exp:low_search:form
result_page="used-equipment/index"
form_id="used_eq_search eqsearch"

remember="keywords|search:eq_year|search:eq_type|search:eq_make|search:eq_location|search:eq_salesgroup|range-from:eq_pricewithattachment|range-to:eq_pricewithattachment"

status="open"
keywords:match="eq_model"

}

KEYWORD SEARCH

<!--KEYWORD SORT-->

<!--END KEYWORD SORT-->

Replies

  1. Low 15 Feb 2016 08:45

    Remember this rule:

    parameters can be applied in two ways: as input fields in a Form, or as hard-coded parameters in the Results or URL tag


    This means the Form tag does not accept any filtering parameters.

    You have two of those params defined in your form tag: status and keywords:match. Move them to the Results tag instead.

  2. Jason Skinner 16 Feb 2016 03:20

    Still no luck with returning eq_models in the keyword search. A search for "4010" returns results with no search scores.

    Form:

     
    {exp:low_search:form
    result_page="used-equipment/index"
    form_id="used_eq_search eqsearchprice"
    remember="keywords|search:eq_year|search:eq_type|search:eq_make|search:eq_location|search:eq_salesgroup|range-from:eq_pricewithattachment|range-to:eq_pricewithattachment"
    }


    Results:
     
    {exp:low_search:results
    limit="33"
    keywords:match="eq_model"
    status="open"
    }


    Any ideas?

  3. Low 16 Feb 2016 07:45

    Which version of Low Search are you using? The keywords:match parameter was added in v4.4.0.

  4. Jason Skinner 16 Feb 2016 15:17

    We are using 4.4.2 on EE 2.5.2

  5. Low 16 Feb 2016 15:20

    What is the search form you're using (including input fields -- You can use http://pastie.org/ or http://pastebin.com/ for large chunks of code)?

    Also, does the eq_model field contain any more data than just the model code?

  6. Jason Skinner 16 Feb 2016 15:29

    Here is the form: http://pastebin.com/U6GGcqyN

    The first form is a range slider. The second form contains the keywords search.

    eq_model is imported from an xml file and contains the model string only.

  7. Low 16 Feb 2016 15:39

    So, if I understand you correctly, you enter a model string in the name="keywords" field, but the matching entry does not end up on top?

    If so, I'll need to take a look myself. Please send SuperAdmin login credentials to hi at gotolow dot com if you can.

  8. Jason Skinner 16 Feb 2016 15:53

    That is correct. I just sent it with the subject "eq_model keyword search"

  9. Jason Skinner 16 Feb 2016 16:06

    The form can be found in the used-equipment templates

  10. Low 16 Feb 2016 20:42

    Okay, so, right now, when using the Keywords filter, pure numeric terms are filtered out as non-valid search terms (because the full-text functions in MySQL don't support them).

    I'll look into changing this behaviour in LS, so it would trigger the fallback non-full-text search when the keywords contain numeric terms.

    No quick fix, I'm afraid, but I'll look into it.

  11. mrpatricko 21 Feb 2016 02:48

    Hi Low,

    I just wanted to add my up-vote to this topic.

    I'm running into the same issue using the keyword search with our vehicle stock numbers. They're a mix of letters, numbers, and dashes (U55916-2). I had been using Low Search 3.3.3 with great success but once I upgraded to 4.4.2, I noticed that dashes and numbers were getting stripped from searches. I can keep using version 3.3.3 for now but wanted to speak up in favor of a 'raw keywords' option for mixed searches.

    Many thanks!

  12. Low 22 Feb 2016 09:33

    Dashes were always stripped out, but the numbers are new, yes. For a fix (before a new version is available), make sure you're on the latest LS, then open up /libraries/Low_search_words.php and look up line 339, which reads:

    $str = preg_replace('/\P{L}+/u', ' ', $str);


    Change that to

    $str = preg_replace('/[^\p{L}\p{N}]+/u', ' ', $str);


    and rebuild the indexes. That should enable numeric search terms.

  13. mrpatricko 25 Feb 2016 02:01

    Numbers work again... thank you so much! And I see that you've updated it for v4.4.3.

    You're a good man.

  14. Jason Skinner 25 Feb 2016 15:23

    Agreed. Hats off.

    We were already manipulating xml before a cron import, so we created a custom field for keywords and searched that particular field.

    Implemented your solution and it works.

  15. Low 25 Feb 2016 15:25

    Glad it's working for you both. And indeed, v4.4.3 has the fix added to it.