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

Support archive

Search arbitrary, non-field data of a Channel

arvinsim 17 Mar 2014 08:05 question, complete

ionships.

However, is there a way to arbitrarily filter other types of data that are not channel fields? Is there a hook where I can do post
processing on the results of low search to do some filtering on my own?

Here is an example of a scenario I am looking it.


I have a channel named 'foo' and 'bar'. Members have the privilege to post/edit entries of both these channels.

If you are familiar with Objectivehtml's Safecracker Registration, then 'foo' is the channel associated to members.
If not then think of 'foo' as some sort of "custom fields" channel for a member.

The channel 'bar' is connected to 'foo' via the 'author_id'. That simply means that any member can have zero or more 'bar' entries

The feature I am trying to implement is to have search like this: "Get all 'foo' entries whose 'bar' entries have a name = X"


Let me know if this was not clear enough. I am happy to explain things further.

Replies

  1. Low 17 Mar 2014 08:27

    As you would expect, this kind of custom filtering is not possible out of the box with Low Search. You could go about it in two ways.

    The easiest is to create a searchable field 'author' in your 'foo' channel and use this method to populate it with searchable data from the other channel. You can then search that field instead of the other channel.

    The other option is to create a custom filter using the low_search_pre_search hook. With that, you can read out all parameters, query the database, and set the entry_id parameter with the search results.

  2. arvinsim 18 Mar 2014 09:55

    I see. The second solution would do nicely. The first one seem more complicated than it is worth. Thanks!