Return-Path: X-Original-To: apmail-lucene-solr-user-archive@minotaur.apache.org Delivered-To: apmail-lucene-solr-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 05C24603F for ; Wed, 18 May 2011 15:19:26 +0000 (UTC) Received: (qmail 84912 invoked by uid 500); 18 May 2011 15:19:23 -0000 Delivered-To: apmail-lucene-solr-user-archive@lucene.apache.org Received: (qmail 84858 invoked by uid 500); 18 May 2011 15:19:23 -0000 Mailing-List: contact solr-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-user@lucene.apache.org Delivered-To: mailing list solr-user@lucene.apache.org Received: (qmail 84850 invoked by uid 99); 18 May 2011 15:19:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 May 2011 15:19:23 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [162.129.8.141] (HELO ipex1.johnshopkins.edu) (162.129.8.141) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 May 2011 15:19:16 +0000 X-IronPort-AV: E=Sophos;i="4.65,231,1304308800"; d="scan'208";a="67995158" Received: from sys02.staff.ad.mse.jhu.edu (HELO [128.220.8.101]) ([128.220.8.101]) by ipex1.johnshopkins.edu with ESMTP/TLS/DHE-RSA-CAMELLIA256-SHA; 18 May 2011 11:18:54 -0400 Message-ID: <4DD3E35E.9050904@jhu.edu> Date: Wed, 18 May 2011 11:18:54 -0400 From: Jonathan Rochkind User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: Nikhil Chhaochharia CC: "solr-user@lucene.apache.org" Subject: Re: Set operations on multiple queries with different qf parameters References: <522094.57002.qm@web95205.mail.in2.yahoo.com> <4DD292C4.80108@jhu.edu> <405267.81974.qm@web95202.mail.in2.yahoo.com> In-Reply-To: <405267.81974.qm@web95202.mail.in2.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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 > To: solr-user@lucene.apache.org; Nikhil Chhaochharia > 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 >> >>