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

Support archive

Low Search and keywords inside HTML tags

Misha Avrekh 22 Mar 2017 15:51 question, complete

Our content managers have noticed that whenever a keyword is enclosed in tags in a channel entry and the field format is set to None, Low Search does not find that entry. For example, if you search for "little flower" and this text only appears as little flower in an entry, the entry will not come up in the search results.

It looks like if you change the format to XHMTL, the entry with the HTML-enclosed keyword starts to come up. If you change the format back to None, the entry continues to come up (possibly because it got indexed?)

I've searched the archives and read the docs, but I am still puzzled by this behavior. Should we just change all our text-containing fields to XHTML?

Thanks in advance for your help!

Misha

Replies

  1. Low 22 Mar 2017 15:59

    Low Search takes the text that is stored in the exp_channel_data table for a given field, then removes all punctuation, diacritics and HTML tags from the text before adding it to its collection index. The index is then used for keyword searches.

    This means that if your entry contains an HTML <table> and you search for the keyword 'table', you won't get that entry as a result.

    You can check the before/after text by checking the DB for that entry/field in exp_channel_data and exp_low_search_indexes (look for the entry ID).

  2. Misha Avrekh 22 Mar 2017 18:50

    Thanks for pointing me to the exp_low_search_indexes table. Some of the entries had only entry titles but not the body field texts in there. Rebuilding the index fixed the issue.

  3. Misha Avrekh 30 Mar 2017 21:52

    Hi again,

    I'm noticing another weirdness possibly related to this. I have a very short keyword ("cobu") that is part of the index_text field in exp_low_search_indexes but does not return the correct entries when searched on the site. I have noticed, however, that low search includes the entry ids for the entries containing the keywords in its fixed_order variable, but then fails to return the actual entries:

    ....
    0.053465 / 8.1MB Low Search: Parameters set: keywords:lang="en" query="cobu" result_page="search/index" limit="25" keywords="cobu" fixed_order="4356|3709"
    0.053477 / 8.1MB Low Search: Pre-applying search vars to tagdata
    0.055462 / 8.1MB Low Search: Calling the channel module
    0.095543 / 10.0MB Returning No Results Content
    0.095575 / 10.0MB Low Search: Found low_search variables in no_results block, calling filters to parse
    0.097775 / 10.0MB -> Data Returned
    0.097831 / 10.0MB Detecting Tags in Template
    0.097935 / 10.0MB Running Tags
    0.098182 / 10.0MB Calling Tag: {exp:low_search:suggestions keywords="cobu" keywords:lang="en" limit="2"}
    0.098518 / 10.0MB Low Search: Prepping if no_suggestions conditional
    ....

    I have rebuilt all indexes and updated low search to 5.1.0

    Thanks for any pointers!

    Misha

  4. Low 31 Mar 2017 08:24

    In that case, the search results are negated by other (native) filters, most likely status (defaults to "open") or future/expired entries.

  5. Misha Avrekh 31 Mar 2017 15:36

    Ah yes, it was the status. Thanks for reminding me!