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 77DB2DCDB for ; Thu, 5 Jul 2012 20:20:11 +0000 (UTC) Received: (qmail 35965 invoked by uid 500); 5 Jul 2012 20:20:08 -0000 Delivered-To: apmail-lucene-solr-user-archive@lucene.apache.org Received: (qmail 35924 invoked by uid 500); 5 Jul 2012 20:20:08 -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 35914 invoked by uid 99); 5 Jul 2012 20:20:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Jul 2012 20:20:08 +0000 X-ASF-Spam-Status: No, hits=2.5 required=5.0 tests=FREEMAIL_REPLY,FSL_RCVD_USER,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of andymeredith@gmail.com designates 209.85.212.48 as permitted sender) Received: from [209.85.212.48] (HELO mail-vb0-f48.google.com) (209.85.212.48) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Jul 2012 20:20:03 +0000 Received: by vbjk17 with SMTP id k17so7178972vbj.35 for ; Thu, 05 Jul 2012 13:19:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=tWBbvJuRnC3fi0OQIcmPjiJ3lraPS+imX0JrS1A0mNE=; b=FNueyCwN7ajyBOHuPhkJhCAST+h65kkkMmDx7YdoJ3OkutdKEwmModpe9qDa7hzEYh VIxSpSghpA7UBJ2zSpS+5/pq3rfA2FrrKdCJgh5PGOI/bWemDKVifFPtXO194pjjFBkA Qk/bspKkxCg6vJhImhEZc3WYbb3Qjq6IwTQsoa3jMk2m1LY3eEbnPEEt7uN12bY5XvGR cOVMf2cRQbj1QdaaxtHzVNMuNsMQAUnWCRyL1859XTW6qsNQ6IS1x3ONsgcMCDvngpzZ bdldqA4wd+I7RPhiga6JHXnmkcwmFphEaoNJwgfqwmaznCshYghxq8HxzArNTqZIrieK ZsLQ== MIME-Version: 1.0 Received: by 10.220.220.203 with SMTP id hz11mr9559852vcb.41.1341519582190; Thu, 05 Jul 2012 13:19:42 -0700 (PDT) Received: by 10.220.200.201 with HTTP; Thu, 5 Jul 2012 13:19:42 -0700 (PDT) In-Reply-To: References: Date: Thu, 5 Jul 2012 14:19:42 -0600 Message-ID: Subject: Re: Filtering a query by range returning unexpected results From: Andrew Meredith To: solr-user@lucene.apache.org Content-Type: multipart/alternative; boundary=14dae9d24d3027de1504c41adeac X-Virus-Checked: Checked by ClamAV on apache.org --14dae9d24d3027de1504c41adeac Content-Type: text/plain; charset=ISO-8859-1 Thanks! That worked. I re-built the index with my "prices" field being of the tfloat type, and I am now able to perform range queries. I appreciate your help, Erick. On Tue, Jul 3, 2012 at 9:35 AM, Erick Erickson wrote: > OK, this appears to be something with the "currency" type. It works fine > for > regular float fields. I can't get the multiValued currency types to work > with > range queries. Don't quite know what I was doing when I thought they > _did_ work. > > One work-around I think, if you are using a single currency USD might be > to copy your price to a simple float field and do your range queries on > that. > > I'm not at all sure that the currency type was ever intended to support > multiValued="true". I don't know enough about the internals to know if > it's even a good idea to try, but the current behavior could be improved > upon. > > But it seems to me that one of two things should happen: > 1> the startup should barf if a currency type is multiValued (fail early) > or > 2> currency should work when multiValued. > > Unfortunately, JIRA is down so I can't look to see if this is already a > known > issue or enter a JIRA if it isn't. I'll try to look later if it all > comes back up. > > Best > Erick > > On Mon, Jul 2, 2012 at 1:53 PM, Andrew Meredith > wrote: > > Yep, that 15.00.00 was a typo. > > > > Here are the relevant portions of my schema.xml: > > > > > > > > precisionStep="8" > > defaultCurrency="USD" currencyConfig="currency.xml" /> > > > > > > > > > > > > > multiValued="true" /> > > > > > > > > And here is the output of a sample query with &debugQuery=on appended: > > > > > > Furtick > > Furtick > > > > +DisjunctionMaxQuery((subtitle:furtick | frontlist_flapcopy:furtick^0.5 | > > frontlist_ean:furtick^6.0 | author:furtick^3.0 | series:furtick^1.5 | > > title:furtick^2.0)) () > > > > > > +(subtitle:furtick | frontlist_flapcopy:furtick^0.5 | > > frontlist_ean:furtick^6.0 | author:furtick^3.0 | series:furtick^1.5 | > > title:furtick^2.0) () > > > > > > ExtendedDismaxQParser > > > > > > > > prices:[5.00 TO 21.00] > > forsaleinusa:true > > > > > > > > ConstantScore(frange(currency(prices)):[500 TO 2100]) > > > > forsaleinusa:true > > > > > > 3.0 > > > > 2.0 > > > > 2.0 > > > > > > 0.0 > > > > > > 0.0 > > > > > > 0.0 > > > > > > 0.0 > > > > > > 0.0 > > > > > > 0.0 > > > > > > > > 1.0 > > > > 1.0 > > > > > > 0.0 > > > > > > 0.0 > > > > > > 0.0 > > > > > > 0.0 > > > > > > 0.0 > > > > > > 0.0 > > > > > > > > > > > > > > If I run this same query with the filter, prices:[5.00 TO 99.00], then I > > get a result that includes the following field: > > > > > > 12.99,USD > > 14.99,USD > > 15.00,USD > > 25.00,USD > > > > > > > > I can't figure out why this is not being returned with the first query. > > I'll try re-building the index with the "prices" field type set to float > > and see if that changes the behaviour. > > > > On Sat, Jun 30, 2012 at 6:49 PM, Erick Erickson >wrote: > > > >> This works fine for me with 3.6, float fields and even on a currency > type. > >> > >> I'm assuming a typo for 15.00.00 BTW. > >> > >> I admit I'm not all that familiar with the "currency" type, which I > infer > >> you're > >> using given the "USD" bits. But I ran a quick test with currency types > and > >> it worked at least the way I ran it... But another quick look shows that > >> some interesting things are being done with the "currency" type, so who > >> knows? > >> > >> So, let's see your relevant schema bits, and the results of your query > >> when you attach &debugQuery=on to it..... > >> > >> > >> Best > >> Erick > >> > >> On Fri, Jun 29, 2012 at 2:43 PM, Andrew Meredith < > andymeredith@gmail.com> > >> wrote: > >> > First off, I have to say that I am working on my first project that > has > >> > required me to work with Solr, so my question my be very elementary - > I > >> > just could not find an answer elsewhere. > >> > > >> > I am trying to add a ranged query filter that returns all items in a > >> given > >> > "prices" range. In my situation, each item can have multiple prices, > so > >> it > >> > is a multivalued field. When I search a range, say, prices:[15.00.00 > TO > >> > 21.00], I want Solr to return all items that have *any* price in that > >> > range, rather than returning results where *all* prices are in the > range. > >> > For example, if i have an item with the following prices, it will not > be > >> > returned: > >> > > >> > 19.99,USD > >> > 22.50,USD > >> > > >> > > >> > Is there any way to change the behaviour of Solr so that it will match > >> > documents in which any value of a multivalued field matches a ranged > >> query > >> > filter? > >> > > >> > Thanks! > >> > > >> > -- > >> > > >> > S.D.G. > >> > > > > > > > > -- > > Andrew Meredith > > > > Personal Blog: Soli Deo Gloria > > Programming Blog > > > > S.D.G. > -- Andrew Meredith Personal Blog: Soli Deo Gloria Programming Blog S.D.G. --14dae9d24d3027de1504c41adeac--