Closed (fixed)
Project:
Apache Solr Search
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
26 Nov 2008 at 18:33 UTC
Updated:
28 Sep 2009 at 17:46 UTC
Jump to comment: Most recent file
Comments
Comment #1
moshe weitzman commentedI'm not real familiar with apachesolr implementation. a few thoughts:
- facets should work even if og_access is disabled. note that there will be no need to for node access control in this case.
- module_exists() instead of module_list()
- node admins probably should still see facets based n their subscribed groups, even though they can see everything.
Comment #2
pwolanin commentedRight - this does sound like it should be separate from the node access module - node access will be handled independently there.
Should this jsut be a separate module?
Comment #3
aufumy commentedOn one hand, having a separate module, is more modular, no pun intended :), and would be more intuitive for people searching for organic group integration to apachesolr.
On the other hand, it seems to be unnecessary repetition. I assumed with the closing of this issue: http://drupal.org/node/255796, that it meant it would all be tied to the nodeaccess tables.
Audrey
Comment #4
aufumy commentedAnyway, here is the initial patch
Comment #5
pwolanin commentedI think the other issue was closed for just the node access aspects of the proposal. i.e. we should not need a distinct implementation per node access module.
To the extent that OG needs facets that are distinct from other types of nodes, this could be a separate module.
Also, feedback appreciated on the notion of trying to make a centralized hook for managing facets/blocks: http://drupal.org/node/339467
Comment #6
JacobSingh commentedHi Aufumy,
It really wouldn't be hard to convert this to using its own field. If you want help with it, ping me and I'll try to assist. I don't think we will want to commit it piggy backing on nodeaccess, but everyone really wants this feature!
Best,
Jacob
Comment #7
pwolanin commented@Jacob - I assume this could just add one or more dynamic fields like CCK fields using hook_apachesolr_update_index().
Something like (I;m not sure this this the exact format of the group info on the loaded node):
Is there any way to insure that there is not collision between dynamic fields? Maybe we should be adding the string 'cck' or some such to the cck fields? I gues the have 'field_' as a somewhat distinct prefix now.
Comment #8
aufumy commentedOk, here is with modification to schema.xml, adding group_id and group_name as multi-value.
Module provides a group facet block, and also includes http://drupal.org/node/334130 (theme the group info in search results)
Comment #9
pwolanin commentedwhy do we need to modify the schma if we have existing dynamic fields?
Actually - seems we don't have a dynamic field that is integer (rather than a sint).
Comment #10
pwolanin commentedWe need to alter the code so that we keep namespaces more separate. Also, for schema I think so we should think about having the int fields by integer not sint by default.
Comment #11
pwolanin commentedsee: http://drupal.org/node/340222#comment-1129870
Comment #12
aufumy commentedOk, apachesolr_og.module now using dynamic fields for group id (integer) and group name (string).
Also includes
- a better listing of group names and link to group in search results,
- better display of breadcrumb (name instead of id),
- group faceting.
Comment #13
JacobSingh commentedHI Audry,
This looks really good. I have a few ideas though you may want to consider:
#Shouldn't this use the same apachesolr_index_key function?
$blocks['imfield_og_gid'] = array('info' => t('ApacheSolr Search: Filter by group'));
#Is this inefficient:
while ($row = db_fetch_object($result)) {
$all_groups[$row->nid] = $row->og_description;
}
#I don't know how much this matters. I suppose only on a site like g.d.o. would this be an issue. I don't think we need to worry about it now, and since we are planning to use this code to index g.d.o., I guess we'll find out! The only alternative is to iterate results twice I suppose and extract the gids for an IN() query, but those are also pretty slow... Or do many selects() (this might actually be faster).
I think if we fix the first thing so that the naming stays consistent even if we change the function to generate the name, this is good to go.
Best,
Jacob
Comment #14
aufumy commented1) Using apachesolr_index_key()
* added functions _apachesolr_og_gid_key() and _apachesolr_og_name_key() which returns 'imfield_og_gid' and 'smfield_og_name'
* replaced almost all instances of 'imfield_og_gid' and 'smfield_og_name' with these functions, except the breadcrumb theming function
2) While loop
* removed the while loop, that was a throwback from a previous patch that was based on piggybacking apachesolr_nodeaccess. In this module since the organic group name is also indexed, the name can be obtained from solr search response
Comment #15
pwolanin commented@aufumy - seems to be some code-style issues. Also, the planned shift to return minimum data will require some alteration here to add fl params to the query.
Comment #16
aufumy commented@pwolanin , re code-style, apologies, I will run it through coder, and fix.
About fl params, could you elaborate, do I need to hold off, or add/modify something?
Comment #17
pwolanin commentedsee: http://drupal.org/node/338534
"we could use a default fl parameter something like
fl=id,title,comment_count,type,changed,score,url,uid,nameand get a Solr-generated snippet of the body back in the highlighting."Basically, any module that needed additional fields would need to alter the query to add additional fields. Probably you can just move forward with this, but we'll need to revisit once that other issue gets some code/traction.
Comment #18
aufumy commentedOkay, here is patch with coder style issues fixed.
Comment #19
JacobSingh commentedHi Audry,
I don't have an o.g. site to test this on, but I'll get the g.d.o. DB from peter and give it a shot this week. It looks great though so I assume we'll commit it by Friday.
Thanks for making this!
Best,
Jacob
Comment #20
pwolanin commentedObviously the commit did not happen yet - needs to be re-rolled for APi changes to facet handling.
Comment #21
JacobSingh commentedHere is a partial re-roll.
Info file still needs a change or two, etc..
Major bug is the facet block, doesn't include the search query. Not sure why yet.
Comment #22
moshe weitzman commentedHey guys. groups.drupal.org is getting close to a d6 launch. Any chance someone can push this toward commit?
Comment #23
pwolanin commentedA quick question about this - do you see there being a reasonable use case for multi-site faceting on groups? Possibly we should just exclude that possibility for now and focus on making it work since site.
Also, for other facets (like taxonomy terms) we are not adding links to the search results - why is that important for groups?
Comment #24
moshe weitzman commentedNah, multi-sites are not likely to share groups. Thats just too mind bending. Groups are really for webmasters that like one site instead of many. I think you can ignore multi-site here.
Perhaps someone else can respond top the links question.
Comment #25
pwolanin commentedI've got this mostly working - but things break due to the ordering of the call to hook_nodeapi (which we should likely remove anyhow) and hook_apachesolr_process_results
Comment #26
pwolanin commentedbetter - correctly indexes gid as 0 for no groups.
Comment #27
pwolanin commenteddoh - also missing a very obvious little thing - a "search within this group" block.
Comment #28
pwolanin commentedcommitting this patch (no search block) - open another issue for follow-ups. Moshe says something above about restricting the facet block based on the current user's groups - not sure I understand the intent of that.
Note there is a switch from calling hook_nodeapi to a new _alter hook.
Comment #29
aufumy commentedAwesome, thank you.
Enabling Apache Solr Node Access module, and re-indexing, will take care of the user's permission to view search/facet results only from the groups that they have access to.
Regarding adding links to the search result, I will follow up as suggested in a new issue to discuss.
Comment #30
pwolanin commentedSince OG itself does not (currently) add links to the groups for core search results - this seemed possibly like a theme-level decision.
Comment #32
moshe weitzman commentedFYI, this is running on groups.drupal.org now.
Comment #33
aufumy commentedyay!