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 Chris Chris <co...@gmail.com> on 2016/10/12 09:26:27 UTC

multivalued coordinate for geospatial search

Hello solr users!

I am trying to use geospatial to do some basic distance search in Solr4.10

At the moment, I got it working if I have just on set of coordinate
(latitude,longitude) per document.

However, I need to get it to work when I have an unknown numbers of set of
coordinates per document: the document should be returned if any of its
coordinates is within the distance threshold of a given coordinate.


Below is how it is working when I have just one set of coordinate per
document.

<fieldType name="location"  class="solr.LatLonType"
subFieldSuffix="_coordinate"/>
<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8"
omitNorms="true" positionIncrementGap="0"/>

<field name="lon_lat" type="location" indexed="true"  stored="false"
 multiValued="false" />
<copyField source="latitude" dest="lon_lat_0_coordinate" />
<copyField source="longitude" dest="lon_lat_1_coordinate" />


The reason why I am using the copyField is because the latitude and
longitude are provided in separate fields, not in the "lat,lon" format.
So far, all my attempts to use multivalued failed, and I would greatly
appreciate some help.

Thanks!

Chris

Re: multivalued coordinate for geospatial search

Posted by Emir Arnautovic <em...@sematext.com>.
Hi Chris,

In order to make it work you have to concatenate lat/lon before it 
reaches indexing. You can do that by using processor chain and adding 
ConcatFieldUpdateProcessorFactory.

Emir


On 12.10.2016 11:26, Chris Chris wrote:
> Hello solr users!
>
> I am trying to use geospatial to do some basic distance search in Solr4.10
>
> At the moment, I got it working if I have just on set of coordinate
> (latitude,longitude) per document.
>
> However, I need to get it to work when I have an unknown numbers of set of
> coordinates per document: the document should be returned if any of its
> coordinates is within the distance threshold of a given coordinate.
>
>
> Below is how it is working when I have just one set of coordinate per
> document.
>
> <fieldType name="location"  class="solr.LatLonType"
> subFieldSuffix="_coordinate"/>
> <fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8"
> omitNorms="true" positionIncrementGap="0"/>
>
> <field name="lon_lat" type="location" indexed="true"  stored="false"
>   multiValued="false" />
> <copyField source="latitude" dest="lon_lat_0_coordinate" />
> <copyField source="longitude" dest="lon_lat_1_coordinate" />
>
>
> The reason why I am using the copyField is because the latitude and
> longitude are provided in separate fields, not in the "lat,lon" format.
> So far, all my attempts to use multivalued failed, and I would greatly
> appreciate some help.
>
> Thanks!
>
> Chris
>

-- 
Monitoring * Alerting * Anomaly Detection * Centralized Log Management
Solr & Elasticsearch Support * http://sematext.com/