lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leo BRUVRY-LAGADEC <Leo.Bruvry.Laga...@partenaire-exterieur.ifremer.fr>
Subject request SOLR - spatial field with Intersect and Contains functions
Date Mon, 19 Sep 2016 12:48:02 GMT
Hi,

I am trying spatial search in SOLR 5.0 and I don't know how to implement 
a solution for the problem I will try to explain.

On a SOLR server I have indexed a collection of objects that contains 
spacial field :

<field name="geo" type="location_rpt" indexed="true" stored="true" 
multiValued="true" />
<fieldType name="location_rpt" 
class="solr.SpatialRecursivePrefixTreeFieldType"
                geo="true"
                distErrPct="0.025"
                maxDistErr="0.000009"
                distanceUnits="degrees" />

The spatial data indexed in the field named "geo" can be ENVELOPE or 
LINESTRING :

<field name="geo">LINESTRING(-4.6837 48.5792, -4.6835 48.5788, -4.684 
48.5788, -4.6832 48.579, -4.6837 48.5792, -4.6188 48.6265, -4.6122 
48.63, -4.615 48.6258, -4.6125 48.6215, -4.6112 48.6218)</field>

or

<field name="geo">ENVELOPE(-5.0, -4.0, 49.0, 48.0)</field>

Actually in my application, when I do a SOLR request to get objects that 
are in a spatial area, I do something like this :

q=:&fq=(geo:"Intersects(ENVELOPE(-116.894531, 107.402344, 57.433227, 
-42.146973))")

But I want to change how it work. Now, when the geo field contain an 
ENVELOPE I want to do an CONTAINS request and when it contain a 
LINESTRING I want to do an INTERSECTS request.

example :

If geo = ENVELOPE then q=*:*&fq=(geo:"Contains(ENVELOPE(-116.894531, 
107.402344, 57.433227, -42.146973))")

If geo = LINESTRING then q=*:*&fq=(geo:"Intersects(ENVELOPE(-116.894531, 
107.402344, 57.433227, -42.146973))")

How can my application know if the field contain ENVELOPE or LINESTRING ?

Any idea can this be done ?

Best reguards,
Leo.

Mime
View raw message