You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Poornima Jay <po...@rocketmail.com> on 2014/08/08 11:18:34 UTC

Range field for interger

Hi,

I am using solr 3.6.1 and trying to find a range on a field which was defined as integer. but i'm not getting accurate results. below is my schema.

The input will be as [-1 TO 0] or [2 TO 5]

<fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>

<field name="interestlevel" type="int" indexed="true" stored="false" multiValued="true" />


my query string will be interestlevel:[-1 TO 0] -- this is returning only 2 records from solr where as it has 21 records in the DB.

Please advice.

Thanks,
Poornima

Re: Range field for interger

Posted by Poornima Jay <po...@rocketmail.com>.
Thanks for you reply Uwe.
I have changed the field type to "tint" and the "precisionStep" to 8 after the changes reloaded the core and re-indexed the content. Still no luck.

<fieldType name="tint" class="solr.TrieIntField" precisionStep="8" positionIncrementGap="0"/>


Not sure what is wrong.

Regards,
Poornima


On Friday, 8 August 2014 2:53 PM, Uwe Schindler <uw...@thetaphi.de> wrote:
 


Hi,
 
in most cases the reason for those problems is, because you changed the field definition, but did not reindex all documents or drop the whole index.
In addition, to do range queries, you should use the “tint” fields, which have “precisionStep” > 0, otherwise range queries can get very slow if you have many documents with many distinct integer values.
 
Uwe
-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de
 
From:Poornima Jay [mailto:poornimajay@rocketmail.com] 
Sent: Friday, August 08, 2014 11:19 AM
To: solr-dev; solr-user
Subject: Range field for interger
 
Hi,
 
I am using solr 3.6.1 and trying to find a range on a field which was defined as integer. but i'm not getting accurate results. below is my schema.
 
The input will be as [-1 TO 0] or [2 TO 5]
 
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
<field name="interestlevel" type="int" indexed="true" stored="false" multiValued="true" />
 
my query string will be interestlevel:[-1 TO 0] -- this is returning only 2 records from solr where as it has 21 records in the DB.
 
Please advice.
 
Thanks,
Poornima

RE: Range field for interger

Posted by Uwe Schindler <uw...@thetaphi.de>.
Hi,

 

in most cases the reason for those problems is, because you changed the field definition, but did not reindex all documents or drop the whole index.

In addition, to do range queries, you should use the “tint” fields, which have “precisionStep” > 0, otherwise range queries can get very slow if you have many documents with many distinct integer values.

 

Uwe

-----

Uwe Schindler

H.-H.-Meier-Allee 63, D-28213 Bremen

http://www.thetaphi.de <http://www.thetaphi.de/> 

eMail: uwe@thetaphi.de

 

From: Poornima Jay [mailto:poornimajay@rocketmail.com] 
Sent: Friday, August 08, 2014 11:19 AM
To: solr-dev; solr-user
Subject: Range field for interger

 

Hi,

 

I am using solr 3.6.1 and trying to find a range on a field which was defined as integer. but i'm not getting accurate results. below is my schema.

 

The input will be as [-1 TO 0] or [2 TO 5]

 

<fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>

<field name="interestlevel" type="int" indexed="true" stored="false" multiValued="true" />

 

my query string will be interestlevel:[-1 TO 0] -- this is returning only 2 records from solr where as it has 21 records in the DB.

 

Please advice.

 

Thanks,

Poornima