I'm trying to use the a dismax setting the qt param and then calling apachesolr _search_search function but this function is adding the hash fiter in the query but dismax does not support fielded searches through the regular query.
Is there a workaround for this?
Thanks!
Matias.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | hash_before_hook.patch | 1.1 KB | andrewlevine |
Comments
Comment #1
mburak commentedAny word about this? Or maybe someone telling me how is the right way to do a dismax search.
Thanks!
Comment #2
dipen chaudhary commentedDismax is the standard request handler as of solr 1.3, If you wish to use the standard query handler which allows for detailed lucene operators u'd use q.alt. Dismax is for simple queries on predefined fields which u pass as part of the request or defined in your configuration xml's. Can you be more specific on which "hash filter in the query" u mean here? I've not used q.alt
Oh btw which solr version?
Comment #3
mburak commentedThanks for your reply Dipen. I'm using the last nightly build of solr 1.4.
Basically what i'm trying to do is the following:
I've defined a request handler un my solrconfig.xml:
Then, in a custom module I'm setting this variable:
and finally in another function, I'm calling the original apachesolr_search_search('search', $keys), but this function is adding at some point the hash field to the query:
The problem is that dismax doesn't allow fields in the q param. It takes them as regular keywords.
Comment #4
andrewlevine commentedSo what we can do is move the addition of the hash field above the apachesolr_modify_query hook. That means that a module could take the field out when using dismax. If the attached patch is accepted to the module, the following hook would make dismax work:
Comment #5
andrewlevine commentedComment #6
CKoch commentedThat code won't work with the default apachesolr.xml as it stands.
The main issue is that the 'qf' field if explictly set, overrides the default value.
So, in the example above, that will search _only_ the title field.
What needs to be done is enforcement of the type of the parameters.
Also, the filter for the hash must be added into fq rather than bq (filtering, vs boosting results. bq will just weight results with the hash higher, but you still get results where the hash doesn't match)
Also, the function will need to take into account it's operating in a hook context and that it doesn't wipe out any modules alterations to the parameters.
Comment #7
andrewlevine commentedCKoch, thanks. Just to be clear, my sample hook code was wrong, but the patch worked :)
Comment #8
jpmckinney commented