While i coded the CiviCRM Solr module I noticed the search has no results if the Apache Solr Node Access module has been enabled. I tried to get the applied filters inside the hook_apachesolr_modify_query(), but the $query->get_filters() doesn't returns with the nodeaccess filters, as a plus, the $params doesn't contains the $params['fq'] array.
The reason is that, inside the apachesolr_modify_query() the $params['fq'] comes later than the invoke of the hook_apachesolr_modify_query() functions, and the $query->get_fq() processes the subqueries too, the $query->get_filters() and the $query->remove_filter() don't.
Comments
Comment #1
jpmckinney commentedI assume adding a get_subqueries() will solve this issue. A good idea to have it, in any case. Attaching 6.x-2.x patch, too.
Comment #2
pwolanin commentedSo, in terms of 7.x at least, I think this problem is a good motivation to switch to using ?f[]= for filters, since that wold make it much easier to get rid of the bad/hacky subquery stuff.
Another reason also to look at the Solace code.
Comment #3
pwolanin commentedLooking through the code - I see the only reason the current subquery thing is useful, really, is for handling field aliases.
A quick fix would also be making the subqueries variable public.
Comment #4
jpmckinney commentedI think this fix is just as quick and is in line with how we currently handle instance variables.
Comment #5
jpmckinney commentedMarked #833852: need ability to retrieve array of subqueries from query object duplicate.
Comment #6
pwolanin commentedOut of date with current code
Comment #7
jpmckinney commentedComment #8
pwolanin commentedDo we need to add this to the interface?
fwiw - the interface probably needs some love more generally.
Comment #9
jpmckinney commentedAdded it to interface, and gave comments some love.
Comment #10
pwolanin commented0 byte patch, please re-post.
Comment #11
jpmckinney commentedComment #12
pwolanin commentedThe last comment needs to be changed:
is al ittle wrong now, the params come form method getSolrParams(), or more generally from the params stored in the query object (exactly how they are passed to Solr search(0 is an implementation detail, not part of the interface).
Comment #13
jpmckinney commentedHadn't read that one carefully. Removed most of the words, as it had too many implementation details. Also changed docs for the solr() method.
Comment #14
jpmckinney commentedFigure safe to commit as it was mostly changing comments.