Closed (fixed)
Project:
Drupal Commons
Version:
7.x-3.x-dev
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
5 Sep 2013 at 19:06 UTC
Updated:
1 Oct 2013 at 21:51 UTC
Jump to comment: Most recent file
Comments
Comment #1
ezra-g commentedHere's what I propose:
The initial list of people presented in the People directory is actually generated by an Entity Field Query, whereas once the user searches, the results are provided by Solr.
So, to alter the results we actually need to alter in 2 places: The EFQ and the Solr query or result set. Here are some suggested approaches for each:
1) EFQ:
Use hook_entity_query_alter() to alter the EFQ that generates the initial People directory listing. The attached patch adds a 'commons_search_solr_user_people' tag to make this query easy to detect.
2) Solr results (see apachesolr.api.php).
A) If you can filter based on content that's included the in Solr index: hook_apachesolr_query_alter().
Eg, for each user that is indexed by Solr, Commons_search_solr_user() adds a property that describes a "list of users who are following this user." See im_flag_commons_follow_user in the commons_search_solr_user.module codebase.
B) If the data on which you're filtering is not included in the index, you can use hook_apachesolr_process_results() to process the returned result set.
Comment #2
japerryGood idea adding a tag, should make customization easier. now if we could figure out how to not need EFQ for the default search results...
Comment #3
japerryAdded the solr tag here:
http://drupalcode.org/project/commons.git/commit/2dc9524