According to Low Search's documentation on inclusive values:

I should be able to have the AND operator enabled when searching fields.

So I'm trying to filter my choices from a grid field column: atttributen:waarde

This grid can have many rows and with low_search I want to be able to search for entries which have all the values which I have selected in my low_search:form

In my low_search form I've added this input:

<input type="hidden" name="require_all" value="search:attributen:waarde">

And have several inputs like this:

< input 
    class="form-check-input filter" 
    class="form-check-input filter" 

But strangely enough I'm experiencing different kind of behaviour when getting the results.

The below query string is being created automatically from the form submit, which I've managed to create with an ajax call:


but the above gives an empty result, whereas when I manually change the query to

ajax-results?search:attributen:waarde=xxxx_val_1&&xxxx_val_2 then the resultspage DOES give me results.

According to the documentation, the first query should return the same results as the second query.

When I don't use the require_all parameter, then I get results of entries with the OR (|) operator, but I'm actually trying to achieve to get entries which have specifically BOTH of the values inside the grid column.

Does anybody have an idea what I'm missing here? Thanks in advance!

Using EE 5.3.2, LowSearch 6.2.1

  • Low provides good support for his add-ons via email. This looks like a question you should send to him. Contact info here - gotolow.com/contact Dec 22 '20 at 9:54
  • Thanx, good call, I just mailed him personally. Will place the anwser here when I have a solution figured out.
    – Truong
    Dec 22 '20 at 13:42

Consider the native (regular) field search functionality. Say you have a body field. Using a search:body="foo&&bar" parameter will result in this where-clause:

WHERE (body LIKE '%foo%' AND body LIKE '%bar%')

...which is fine, because a long body field can easily contain both strings. Now consider your example, where you're targeting a Grid field column. Each column contains a specific string, like foo or bar. Using the search:grid:column="foo&&bar" will result in this where-clause

WHERE (column LIKE '%foo%' AND column LIKE '%bar%')

...but this is the issue. The WHERE clause targets the same column and row, which can never hold both keywords. This is why you're not getting any results. You should read the Grid column parameter as "Give me entries where the Grid column contains at least 1 row with values X and Y" instead of "Give me entries where the Grid column contains at least 1 row with value X and at least 1 row with value Y". The latter is currently not possible with Low Search.

As for why LS gives you results back when using search:grid:column=foo&&bar in the query string, that's because the & character delimits variables/params in the query string. That means the value in this example will be foo only, while bar is an empty variable:

[search:grid:column] => 'foo',
[] => '',
[bar] => '',

So you were only getting results where the Grid column matched the one term.

  • Hi Lodewijk, Thanks for clearing that up, that makes sense indeed. Do you have any suggestion on how to use low_search with the particular scenario where you want to filter out entries which have inclusive items within a column in a gridfield? Or do I need to make a custom query for it.
    – Truong
    Dec 23 '20 at 14:24
  • Right now, I think you'd need a custom filter or query for it.
    – Low
    Dec 29 '20 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.