Filter MSM Low Search Results by Site

I would like to filter search results by the site. Is this a possibility?

For example the search would search all sites with entries that match the keywords. Then the user could check which sites they would like to narrow the search to. This would filter out any entries that were not on that particular site.
1 person has
this question
+1
Reply
  • Low (Official Rep) June 06, 2017 07:41
    Yes, you should be able to use the site parameter as any other filtering parameter.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • We wouldn't be filtering by categories, however, it would be a list of checkboxes, one for each site.

    If the user checked siteA it would filter the results to only those entries from siteA. I'm not sure how you would pass the site value to the query. Would this require us to build a filter?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • Low (Official Rep) June 06, 2017 19:56
    Use site as parameter name and treat it like a multi-valued parameter.

    So something like

    <label>
    <input type="checkbox" name="site[]" value="site-a"> Site A
    </label>
    <label>
    <input type="checkbox" name="site[]" value="site-b"> Site B
    </label>
    ...
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • This makes sense. The only issue I'm having is the results tag is showing no results. However, it is clear it is retaining the checked site, because the search form on the results page is saving the correct checkbox as checked.

    Do I need to include anything in the results tag to pull the selected sites over?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • Low (Official Rep) June 06, 2017 20:37
    It should work, but results might be negated by other parameters.

    Can you enable the template debugger and copy/paste all lines that mention Low Search here? Also, in the output profiler where alle the MySQL queries are logged, can you copy/paste all queries here that are generated by Low Search, specifically the one that targets the exp_low_search_indexes table?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • Queries:
    0.0002s
    1.0MB
    SELECT exp_low_search_indexes.entry_id, exp_low_search_indexes.collection_id, exp_low_search_indexes.index_text
    FROM (`exp_low_search_indexes`)
    WHERE `index_text` LIKE '% about %'
    #system/user/addons/low_search/libraries/Low_search_filters.php L:145 Low_search_filter_keywords::filter()
    0.0002s
    197KB
    SELECT *
    FROM (`exp_low_search_collections`)
    ORDER BY `collection_label` asc
    #system/user/addons/low_search/models/low_search_collection_model.php L:87 Low_search_model::get_all()
    0.0002s
    2KB
    SELECT `m_field_id`, `m_field_name`, `m_field_fmt`
    FROM (`exp_member_fields`)
    #system/ee/EllisLab/Addons/channel/mod.channel.php L:176 Channel::fetch_custom_member_fields()
    0.0005s
    2KB
    SELECT t.entry_id FROM exp_channel_titles AS t
    LEFT JOIN exp_channels ON t.channel_id = exp_channels.channel_id LEFT JOIN exp_members AS m ON m.member_id = t.author_id WHERE t.entry_id !='' AND t.site_id IN ('') AND t.entry_id IN ('11','34') AND t.status = 'open'
    #system/ee/EllisLab/Addons/channel/mod.channel.php L:260 Channel::build_sql_query()
    0.0005s
    2KB
    SELECT t.entry_id FROM exp_channel_titles AS t
    LEFT JOIN exp_channels ON t.channel_id = exp_channels.channel_id LEFT JOIN exp_members AS m ON m.member_id = t.author_id WHERE t.entry_id !='' AND t.site_id IN ('') AND t.entry_id IN ('11','34') AND t.status = 'open' ORDER BY FIELD(t.entry_id, 11,34) LIMIT 0, 10
    #system/ee/EllisLab/Addons/channel/mod.channel.php L:260 Channel::build_sql_query()
    0.0015s
    1KB
    UPDATE `exp_low_search_log`
    SET num_results = IF(num_results IS NULL, 1, num_results + 1)
    WHERE log_id = 30
    #system/user/addons/low_search/mod.low_search.php L:2030 Low_search_log_model::add_num_results()
    0.0007s
    1KB
    UPDATE `exp_low_search_log`
    SET num_results = IF(num_results IS NULL, 0, num_results + 0)
    WHERE log_id = 30
    #system/user/addons/low_search/mod.low_search.php L:1938 Low_search_log_model::add_num_results()
    0.0002s
    2KB
    SELECT action_id, class, method FROM exp_actions WHERE (class= 'Search' AND method = 'do_search') OR (class= 'Low_search' AND method = 'catch_search')
    #system/ee/legacy/libraries/Template.php L:3248 EE_Functions::insert_action_ids()

    Variables
    exp_flash: {":new:low_search_log_id":"30"}ebeaf230728be088d094c02261541d3a46c29e5cf480bdfb1ed176315557186f25cc8e4fdd5545caa2e290e5009deb10

    Templates
    0.091357 / 22.6MB Calling Extension Class/Method: Low_search_ext/channel_entries_query_result

    0.126896 / 23.4MB Calling Extension Class/Method: Low_search_ext/channel_entries_query_result

    0.144303 / 6.8MB Calling Tag: {exp:low_search:form}

    0.147547 / 6.8MB Calling Tag: {exp:low_search:results query="eyJrZXl3b3JkcyI6IkFib3V0Iiwic2l0ZSI6ImdyYWNlX2Rvd250b3dufGdyYWNlX21vc2FpY3xncmFjZV9tZXJpZGlhbl9oaWxsfGdyYWNlX25ldHdvcmsifQ" limit="10" paginate="bottom" show_future_entries="yes" show_expired="yes"}
    0.150679 / 6.9MB Low Search: Applying Low_search_filter_keywords

    0.155464 / 6.6MB Calling Extension Class/Method: Low_reorder_ext/low_search_post_search

    0.174786 / 6.5MB Low Search: Found low_search variables in no_results block, calling filters to parse

    0.183493 / 23.9MB Calling Extension Class/Method: Low_search_ext/channel_entries_query_result

    0.205214 / 23.9MB Calling Extension Class/Method: Low_search_ext/channel_entries_query_result

    0.214014 / 23.9MB Calling Extension Class/Method: Low_search_ext/channel_entries_query_result

    0.231191 / 24.2MB Calling Extension Class/Method: Low_search_ext/channel_entries_query_result

    0.244429 / 24.3MB Calling Extension Class/Method: Low_search_ext/channel_entries_query_result

    0.260584 / 7.2MB Calling Tag: {exp:low_search:form}
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • Low (Official Rep) June 06, 2017 21:10
    I'm seeing t.site_id IN ('') in the query that EE generates, which it shouldn't. Not sure why. I'll need to take a look myself. Please send SuperAdmin and FTP login credentials to hi at gotolow dot com if you can. I'll investigate tomorrow; it's late this side of the Atlantic.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • Low (Official Rep) June 07, 2017 18:37
    Looks like it was a bug in Low Search. The site="" parameter doesn't work exactly like other parameters in EE, and LS neglected to take that into account fully.

    I managed to fix it in your installation and will include the fix in the next version of LS.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • Thank you for getting that fixed for me so quickly, I really appreciate your help!
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • Any chance you can point us in the right direction to resolve this? I am having the same issue.

    Nick
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited