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 jo...@findwise.se on 2009/08/20 16:07:06 UTC

Solr Range Query Anomalities

Hi,

we're performing range queries of a field which is of type double. Some
queries which should generate results does not, and I think it's best
explained by the following examples; it's also expected to exist data in
all ranges:


?q=field:[10.0 TO 20.0] // OK
?q=field:[9.0 TO 20.0] // NOT OK
?q=field:[09.0 TO 20.0] // OK

Interesting here is that the range query only works if both ends of the
interval is of equal length (hence 09-to-20 works, but not 9-20).
Unfortunately, this logic does not work for ranges in the 100s.



?q=field:[* TO 500]  // OK
?q=field:[100.0 TO 500.0] // OK
?q=field:[90.0 TO 500.0] // NOT OK
?q=field:[090.0 TO 500.0] // NOT OK



Any ideas to this very strange behaviour?


Regards,
Johan


Re: Solr Range Query Anomalities

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Thu, Aug 20, 2009 at 7:37 PM, <jo...@findwise.se> wrote:

> Hi,
>
> we're performing range queries of a field which is of type double. Some
> queries which should generate results does not, and I think it's best
> explained by the following examples; it's also expected to exist data in
> all ranges:
>
>
> ?q=field:[10.0 TO 20.0] // OK
> ?q=field:[9.0 TO 20.0] // NOT OK
> ?q=field:[09.0 TO 20.0] // OK
>
> Interesting here is that the range query only works if both ends of the
> interval is of equal length (hence 09-to-20 works, but not 9-20).
> Unfortunately, this logic does not work for ranges in the 100s.
>
>
Use a "sdouble" field type if you want to do range searches on that field.

-- 
Regards,
Shalin Shekhar Mangar.

Re: Solr Range Query Anomalities [Solved]

Posted by jo...@findwise.se.
SortableDoubleField works excellent, haven't tried TrieField though.
Thanks for the super fast support everyone.


Regards,
Johan

> On Thursday 20 August 2009 16:07, johan.sjoberg@findwise.se wrote:
>> we're performing range queries of a field which is of type double. Some
>> queries which should generate results does not, and I think it's best
>> explained by the following examples; it's also expected to exist data in
>> all ranges:
>>
>>
>> ?q=field:[10.0 TO 20.0] // OK
>> ?q=field:[9.0 TO 20.0] // NOT OK
>> ?q=field:[09.0 TO 20.0] // OK
>>
>> Interesting here is that the range query only works if both ends of the
>> interval is of equal length (hence 09-to-20 works, but not 9-20).
>> Unfortunately, this logic does not work for ranges in the 100s.
>>
>>
>>
>> ?q=field:[* TO 500]  // OK
>> ?q=field:[100.0 TO 500.0] // OK
>> ?q=field:[90.0 TO 500.0] // NOT OK
>> ?q=field:[090.0 TO 500.0] // NOT OK
>>
>>
>>
>> Any ideas to this very strange behaviour?
>
> You'll want to use SortableDoubleField for range queries to work as
> expected.
>
> Also, do have a look at TrieField if you're on a recent enough version of
> Solr.
>
> .øs
>
> --
> Øystein Steimler, Produktans, EasyConnect AS  -  http://opplysning1890.no
> oystein.steimler@easyconnect.no  - GPG: 0x784a7dea - Mob: 90010882
>



Re: Solr Range Query Anomalities

Posted by "Øystein F. Steimler" <oy...@easyconnect.no>.
On Thursday 20 August 2009 16:07, johan.sjoberg@findwise.se wrote:
> we're performing range queries of a field which is of type double. Some
> queries which should generate results does not, and I think it's best
> explained by the following examples; it's also expected to exist data in
> all ranges:
>
>
> ?q=field:[10.0 TO 20.0] // OK
> ?q=field:[9.0 TO 20.0] // NOT OK
> ?q=field:[09.0 TO 20.0] // OK
>
> Interesting here is that the range query only works if both ends of the
> interval is of equal length (hence 09-to-20 works, but not 9-20).
> Unfortunately, this logic does not work for ranges in the 100s.
>
>
>
> ?q=field:[* TO 500]  // OK
> ?q=field:[100.0 TO 500.0] // OK
> ?q=field:[90.0 TO 500.0] // NOT OK
> ?q=field:[090.0 TO 500.0] // NOT OK
>
>
>
> Any ideas to this very strange behaviour?

You'll want to use SortableDoubleField for range queries to work as expected.

Also, do have a look at TrieField if you're on a recent enough version of 
Solr.

.øs

-- 
Øystein Steimler, Produktans, EasyConnect AS  -  http://opplysning1890.no
oystein.steimler@easyconnect.no  - GPG: 0x784a7dea - Mob: 90010882

Re: Solr Range Query Anomalities

Posted by Andrew Clegg <an...@gmail.com>.
Try a sdouble or sfloat field type?

Andrew.


johan.sjoberg wrote:
> 
> Hi,
> 
> we're performing range queries of a field which is of type double. Some
> queries which should generate results does not, and I think it's best
> explained by the following examples; it's also expected to exist data in
> all ranges:
> 
> 
> ?q=field:[10.0 TO 20.0] // OK
> ?q=field:[9.0 TO 20.0] // NOT OK
> ?q=field:[09.0 TO 20.0] // OK
> 
> Interesting here is that the range query only works if both ends of the
> interval is of equal length (hence 09-to-20 works, but not 9-20).
> Unfortunately, this logic does not work for ranges in the 100s.
> 
> 
> 
> ?q=field:[* TO 500]  // OK
> ?q=field:[100.0 TO 500.0] // OK
> ?q=field:[90.0 TO 500.0] // NOT OK
> ?q=field:[090.0 TO 500.0] // NOT OK
> 
> 
> 
> Any ideas to this very strange behaviour?
> 
> 
> Regards,
> Johan
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Solr-773-%28GEO-Module%29-question-tp25041799p25062912.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr Range Query Anomalities

Posted by Chris Hostetter <ho...@fucit.org>.
: Subject: Solr Range Query Anomalities
: In-Reply-To: <42...@webmail01.one.com>
: References: <42...@webmail01.one.com>

http://people.apache.org/~hossman/#threadhijack
Thread Hijacking on Mailing Lists

When starting a new discussion on a mailing list, please do not reply to 
an existing message, instead start a fresh email.  Even if you change the 
subject line of your email, other mail headers still track which thread 
you replied to and your question is "hidden" in that thread and gets less 
attention.   It makes following discussions in the mailing list archives 
particularly difficult.
See Also:  http://en.wikipedia.org/wiki/Thread_hijacking




-Hoss