lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Rochkind <rochk...@jhu.edu>
Subject Re: Set operations on multiple queries with different qf parameters
Date Wed, 18 May 2011 15:18:54 GMT
Don't know of any other documentation. There might be some minimal page 
on the wiki somewhere, but I can never find it either although I have 
some memory of seeing it once, it didn't have anything that the blog 
post didn't.

I think 'mm' _should_ work as a LocalParam in a nested query, I use it 
myself in code and it seems to work.

But not too surprised that 'fq' doesn't (although I haven't verified 
that myself). If indeed it doesn't, here would be a hacky way to get the 
same semantics, although it won't use the filter cache for the fq.

If this doesn't work:

&defType=lucene&q= _query_:"{!edismax qf='p,q,r' fq='field1:xyz'}abc
def" AND _query_:"{!edismax mm=100% qf='q, r, s'}jlk"


Then this should, we can just put it in our top-level lucene query as an 
additional condition.

&defType=lucene&q= (_query_:"{!edismax qf='p,q,r'}abc def"  AND 
field1:xyz) AND _query_:"{!edismax mm=100% qf='q, r, s'}jlk"

Yeah, this starts to get painful, agreed, with unclear performance 
implications.




On 5/17/2011 10:44 PM, Nikhil Chhaochharia wrote:
> Thanks, this looks good.  mm and fq don't seem to be working for a nested query, but
I should be able to work around it.
> I was unable to find much documentation on the Wiki, API docs or in the Solr book - please
let me know if you are aware of any other documentation for this feature apart from the mentioned
blog post.
>
>
> Thanks,
>
> Nikhil
>
>
>
> ----- Original Message -----
> From: Jonathan Rochkind<rochkind@jhu.edu>
> To: solr-user@lucene.apache.org; Nikhil Chhaochharia<nikhil500@yahoo.com>
> Cc:
> Sent: Tuesday, 17 May 2011 8:52 PM
> Subject: Re: Set operations on multiple queries with different qf parameters
>
> One way to do it might be to use the Solr 'nested query' functionality.
>
> http://www.lucidimagination.com/blog/2009/03/31/nested-queries-in-solr/
>
> Not entirely sure this will work exactly as I've written it, but give
> you some ideas of what nested query can do.  Note not fully URL-encoded
> for clarity:
>
> &defType=lucene&q= _query_:"{!edismax qf='p,q,r' fq='field1:xyz'}abc
> def" AND _query_:"{!edismax mm=100% qf='q, r, s'}jlk"
>
>
>
> On 5/17/2011 2:55 AM, Nikhil Chhaochharia wrote:
>> Hi,
>>
>> I am using Solr 3.1 with edismax.  My frontend allows the user to create arbitrarily
complex queries by modifying q, fq, qf and mm (only 1 and 100% are allowed) parameters.  The
queries can then be saved by the user.
>>
>> The user should be able to perform set operations on the saved searches.  For example,
the user may want to see all documents which are returned both by saved search 1 and saved
search 2 (equivalent to intersection of the two).
>>
>> If the saved searches contain q, fq and/or mm, then I can combine the saved searches
to create a new query which will be equivalent to their intersection.  However, I can't figure
out how to handle qf?
>>
>> For example,
>>
>> Query 1 = q=abc def&fq=field1:xyz&mm=1&qf=p,q,r
>> Query 2 = q=jkl&mm=100%&qf=q,r,s
>>
>> How do I get the list of common documents which are present in the result set of
both queries?
>>
>>
>>
>> Thanks,
>> Nikhil
>>
>>

Mime
View raw message