There is some obvious additional cleanup to do, plus for the d.o redesign it would be nice to support field aliases for sorts.
Damien proposes that all the params for the query should live in the object, not in a separate array and that (since you must pass a Solr object into the query when you instantiate it) that the query even have some kind of execute() type method to actually fetch the result.
Feedback especially on this latter idea appreciated.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | query-more-436074-11.patch | 9.79 KB | pwolanin |
| #10 | query-more-436074-10.patch | 8.95 KB | pwolanin |
| #2 | query-more-436074-2.patch | 6.91 KB | pwolanin |
Comments
Comment #1
Scott Reynolds commentedWith the views query class there are four stages that happen. init, build, alter, execute. I think that lends itself to a very nice flow.
Comment #2
pwolanin commentedhere's a start on more complete handling of negative queries by parsing the leading '-' and taking it as a separate param for make_filter()
(my favorite kind of patch - more lines removed than added)
Comment #3
pwolanin commentedidea fmor Damien: http://drupalbin.com/8844
Comment #4
Scott Reynolds commentedshouldn't there be a build() method does all that code (variable_gets() etc) instead of making the hook_search() unreadable. That would be preferable.
Comment #5
pwolanin commented@Scott - no, I don't think most of that should be in the class itself - for example, the mlt module does not use or need most of this setup.
However, that current is certainly a monster that should be broken up a bit.
Comment #6
Scott Reynolds commentedahh good point. Moving it to a separate function though would be a huge bonus. With localsolr and the Views implementation both basically copy and paste that code in there. If we could just call apachesolr_build_params() that would be advantageous
Comment #7
David Lesieur commentedRegarding comments #4 to #6, #436792: Modular handling of params might be of interest.
Comment #8
Scott Reynolds commentedThey apachesolr_views project does something very similar to whats in this patch for handling negative filters.
Comment #9
pwolanin commentedok, I could even roll it as a boolean like:
if that abstraction is more useful.
Comment #10
pwolanin commentedComment #11
pwolanin commentedA couple more little fixes - committing to 6.x
note - without this the current search block is a bit broken for negative queries:
(-) [* TO *]since it's looking for a function using a name containing '-'.