You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Rafał Kuć <r....@solr.pl> on 2011/10/13 21:45:55 UTC
Dismax question
Hello!
I've got a problem and maybe someone had a similar one ;) I want to
'force' dismax to make a query like the following one:
+title:foo^100 desc:foo
The name and desc fields are only an exmaple, there can be a multiple
fields that lay under the name of 'title' and 'desc'.
What I try to achieve is get the documents that have a match in both
the title and desc fields or only in the title and exclude the documents
that only have a match in the desc field.
Is this possible with dismax ?
--
Regards,
Rafał Kuć
http://solr.pl
Re: Dismax question
Posted by Chris Hostetter <ho...@fucit.org>.
: > Deja-Vu...
:
: > http://www.lucidimagination.com/search/document/3551f130b6772799/excluding_docs_from_results_based_on_matched_field
:
: > -Hoss
:
: Thanks for the answer, the problem is that the query like this:
:
: q=foo&defType=dismax&qf=title&bq={!dismax qf='title desc' v=$q}
:
: causes exception in Solr - "infinite recursion detected".
Hmmm, yeah ... that makes sense given the way local params work (although
i'm amazed Solr actually detects it instead of just crashing -- the local
param parsing is smarter then i thought!)
Assuming this is what i think it is, it's because the "inner" dismax query
is looking for a "bq" param, which is leading to infinite recursion
because there is no bq local param -- if you specify bf='' inside the
{!dismax} that error should go away (but you may still not get the results
you expect if you also have other top level dismax params like pf, etc...
http://www.lucidimagination.com/search/document/a60e420f5c3d8365/searching_for_terms_on_specific_fields#a60e420f5c3d8365
You should be able to bypass the kind of thing entirely by making *both*
of the dismax queries nested queries of some other top level query (so
they can't possibly inherit params from eachother) instead of using bq ...
qq = foo
q = +_query_:"$main" _query_:"$extra"
main = {!dismax ... v=$qq}
extra = {!dismax ... v=$qq}
-Hoss
Re: Dismax question
Posted by Rafał Kuć <r....@solr.pl>.
Hello!
> : I've got a problem and maybe someone had a similar one ;) I want to
> : 'force' dismax to make a query like the following one:
> : +title:foo^100 desc:foo
> :
> : The name and desc fields are only an exmaple, there can be a multiple
> : fields that lay under the name of 'title' and 'desc'.
> :
> : What I try to achieve is get the documents that have a match in both
> : the title and desc fields or only in the title and exclude the documents
> : that only have a match in the desc field.
> Deja-Vu...
> http://www.lucidimagination.com/search/document/3551f130b6772799/excluding_docs_from_results_based_on_matched_field
> -Hoss
Thanks for the answer, the problem is that the query like this:
q=foo&defType=dismax&qf=title&bq={!dismax qf='title desc' v=$q}
causes exception in Solr - "infinite recursion detected".
--
Regards,
Rafał Kuć
http://solr.pl
Re: Dismax question
Posted by Chris Hostetter <ho...@fucit.org>.
: I've got a problem and maybe someone had a similar one ;) I want to
: 'force' dismax to make a query like the following one:
: +title:foo^100 desc:foo
:
: The name and desc fields are only an exmaple, there can be a multiple
: fields that lay under the name of 'title' and 'desc'.
:
: What I try to achieve is get the documents that have a match in both
: the title and desc fields or only in the title and exclude the documents
: that only have a match in the desc field.
Deja-Vu...
http://www.lucidimagination.com/search/document/3551f130b6772799/excluding_docs_from_results_based_on_matched_field
-Hoss