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 <rochk...@jhu.edu> To: solr-user@lucene.apache.org; Nikhil Chhaochharia <nikhil...@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 > >