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

Support archive

Low Search, MSM, and Category IDs

Loren Klingman 23 May 2013 02:24 question, complete

Low Search with MSM and categories. We have several nearly identical sites running in an MSM install. We like to share content between them at times and use low search to filter through that content. One of the things we filter on is the "Media Type" (Photo, Story, etc). Media type is a category group. Because you can't share groups between different sites, each site has it's own copy of the group (but with the same categories). Since low search searches based on the ID, I've realized that a search by media type only returns items on the current site. Do you have any ideas for how I could fix that? We do occasionally add new media types so I would like the listing in the search for to be automatically generated.

Replies

  1. Loren Klingman 23 May 2013 02:29

    I forgot to mention. All the categories will have identical names and url-titles so if either of those can be used to identify that could work.

    Also, right now, we are doing require_all categories so that people can filter for photos of China or Stories of Thailand (another group is geography).

  2. Low 23 May 2013 07:09

    You could try and use this approach, or create your own Low Search extension, where you relate one category ID with another, so if one cat_id is found in the search filters, the related are added automatically.

  3. Loren Klingman 23 May 2013 09:15

    Ok, I'll have to look into making a low search extension to match category url titles and add the extras.

  4. Low 23 May 2013 09:20

    Steps to take:

    Use low_search_pre_search hook;
    Look up the 'category' parameter and get the IDs from it;
    Get all installation wide category IDs that match its names;
    Set the 'category' parameter with all category IDs from that result;
    Return the modified parameters.

    That should probably get you going.

  5. Loren Klingman 14 Jun 2013 15:55

    I didn't realize your plugin automatically anded the groups together. (Such that it was (11|12|13) && (15|16|17).) I accidentally ran across that function which made this much easier. (I had thought require_all category would require all the categories for all groups. I didn't realize it was individual so it would have needed to be require_all category:geography for it to matter.)

    Here is the resultant extension:
    https://github.com/wiseloren/lk_advan...

  6. Low 17 Jun 2013 07:12

    The require_all="" parameter targets other parameters. So:

    - require_all="category" would target the category="" parameter.
    - require_all="category:group1" would target the category:group1="" parameter.
    - require_all="category:group1|category:group2" would target both the category:group1="" and the category:group2 parameters.
    - require_all="category|search:field1" would target the category="" parameter and the search:field1="" parameter.