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 Niharika <ni...@kex-ag.com> on 2020/03/10 09:07:10 UTC

Solr range search queries

hello, 

I have  two field declared in schema xml as 
 
*<field name='longitude' type='string' indexed='true' stored='true'
required='false' multiValued='true' </field>
<field name='latitude' type='string' indexed='true' stored='true'
required='false' multiValued='true'></field>
*

I want to generate a query to find all the result in specific range for
longitude and latitude

My query looks like 

*latitude:[47.010225655683485 TO 52.40241887397332] AND
longitude:[-2.0214843750000004 TO 14.633789062500002]*

the problem here is:- i am not getting all the result i except, can anyone
suggest me what I can do here and why it is wrong?

PS:- I have already tried rounding of the decimals, I cannot change the type
from string in schema.xml. 

Thanks & Regards
Niharika 




--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Solr range search queries

Posted by Paras Lehana <pa...@indiamart.com>.
Hi Niharika,

Range queries for string fields would work lexicographically and not
numeric I think. Read:
https://lucene.apache.org/solr/guide/6_6/the-standard-query-parser.html#TheStandardQueryParser-RangeSearches
.

If this is the case, [2 TO 5] will include 200 and [2 TO 20] will not
include 19.

On Tue, 10 Mar 2020 at 15:09, Niharika <ni...@kex-ag.com> wrote:

> hello,
>
> I have  two field declared in schema xml as
>
> *<field name='longitude' type='string' indexed='true' stored='true'
> required='false' multiValued='true' </field>
> <field name='latitude' type='string' indexed='true' stored='true'
> required='false' multiValued='true'></field>
> *
>
> I want to generate a query to find all the result in specific range for
> longitude and latitude
>
> My query looks like
>
> *latitude:[47.010225655683485 TO 52.40241887397332] AND
> longitude:[-2.0214843750000004 TO 14.633789062500002]*
>
> the problem here is:- i am not getting all the result i except, can anyone
> suggest me what I can do here and why it is wrong?
>
> PS:- I have already tried rounding of the decimals, I cannot change the
> type
> from string in schema.xml.
>
> Thanks & Regards
> Niharika
>
>
>
>
> --
> Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>


-- 
-- 
Regards,

*Paras Lehana* [65871]
Development Engineer, *Auto-Suggest*,
IndiaMART InterMESH Ltd,

11th Floor, Tower 2, Assotech Business Cresterra,
Plot No. 22, Sector 135, Noida, Uttar Pradesh, India 201305

Mob.: +91-9560911996
Work: 0120-4056700 | Extn:
*1196*

-- 
*
*

 <https://www.facebook.com/IndiaMART/videos/578196442936091/>