I think the query in apachesolr_get_nodes_to_index() should be db_rewrite_sql wrapped; some modules use db_rewrite hooks to add visibility access to nodes.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | db_rewrite.patch | 1.77 KB | flexer |
| #6 | dbrewrite.patch | 1.75 KB | flexer |
I think the query in apachesolr_get_nodes_to_index() should be db_rewrite_sql wrapped; some modules use db_rewrite hooks to add visibility access to nodes.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | db_rewrite.patch | 1.77 KB | flexer |
| #6 | dbrewrite.patch | 1.75 KB | flexer |
Comments
Comment #1
flexer commentedShould db_rewrite_sql also the queries in apachesolr_index_status()
I did it and it seems to work fine.
Comment #2
flexer commentedMmmh... also in the hook_enable of apachesolr.install. Btw, shouldn't be hook_disable() to implement too? Like, to empty the apachesolr_search_node. Or it'll trigger the full reindex?
Comment #3
flexer commentedAnother one: the "select count(*)" in apachesolr_search_search
Comment #4
pwolanin commentedThe way things are set up now, the search only respects node access grants, not other uses of db_rewrite_sql (e.g. my modr8 module). If we did this re-write, would it be on the basis of an anonymous user? An authenticated user? I really don't see that this is feasible in practice. We need to be able to do the access check at query time.
Comment #5
pwolanin commentedI think the bottom line is that to moderate content with Solr you need to have the moderated content be unpublished
Comment #6
flexer commentedI see your point. The problem is that we have many sites with one big shared node table. We do not use node_access to route content visibility (because the setup is greatly complex), but instead we use our system (similar, just another table - something like the domain module). Long story short: we rely all over on db_rewrite_sql to let A SITE (and its users) see only ITS nodes (users are also shared, but this is another story).
If you do not add the db_rewrites, no problem... we still continue to patch the modules ourselves :)
Attached is the patch we use.
Thank you
Comment #7
flexer commentedSorry, that patch is all wrong.
Better one, this time :)
Comment #8
pwolanin commentedThere is probably much easier way to do this - if you want to restrict results to just the current site, modify the query (with the hook) to add a fq param to match the site hash.
Comment #9
flexer commentedYes, I have that too (and it works).
The rewrite are needed when the module looks for available nodes to index.
Comment #10
pwolanin commentedThis last snippet is totally wrong (At least now w/ the dismax handler). You must add it as a fq param.