1

I'm trying to brainstorm the best way to setup a product search functionality on a site in development. I thought maybe I would have one entry per product, then each variation of that product would be in its own Matrix row (columns = item#, color, woodtype, image url, etc.). So if I searched for "Tables" with color "White", woodtype "Pine", I could return the image of that product variation as well as the rest of the variation's row content(Only ever finding the one exact matching result). I'm looking to use a third-party search plugin, so Low Search or SolSpace Super Search. I'm also hoping to eventually return the result via Ajax if one of those plugins makes that easier.

Or maybe each variation variable is a category? Then I could search for "Tables" with "White" set as the color category, "Pine" set as the woodtype category, etc.? Or use Tags?

Any thoughts on the best way to accomplish this would be great. Thanks!

1

In Low Search, if you want the Matrix data to be searchable via Keywords, you'd have to use the same approach as Super Search: set the columns as "searchable".

However, you can also use Low Search's Field Search filter to target specific Matrix columns, regardless of whether they're marked as searchable or not.

Both searching methods will return the entry the Matrix field belongs to. To return just the Matrix row within that entry, you'd have to use its search parameters to pull out specific rows.

| improve this answer | |
  • Thank you both for your answers. It looks like you can only search within one column/field of a matrix row using search:field_name="". Any way around this? I want the search to check all the fields of a Matrix row and only return the row that matches each field exactly. – Mike Lohrman Apr 11 '14 at 18:36
  • 1
    You can use search:col1="foo" search:col2="foo" for searching multiple columns for the same term. However, that will return rows where both columns contain foo. Searching for col1 == 'foo' OR col2 == 'foo' isn't possible, as far as I know. – Low Apr 13 '14 at 8:34
  • Thanks Low, looks like I might have to go a different route with the channel fields for this project – Mike Lohrman Apr 14 '14 at 16:21
1

If you set your Matrix columns as "searchable", data in the Matrix field get saved in exp_channel_data, which Super Search can use in its searches.

You could then search in your Matrix field for the word "Pine", for example, and if there is a match, use regular Matrix tags to pull out the specific row containing "Pine".

| improve this answer | |

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.