Re: Solr 4 spatial queries, jts and polygons

2012-10-03 Thread Ere Maijala

Thanks David,

this is very good news. :)

Regards,

Ere

1.10.2012 21.46, Smiley, David W. kirjoitti:

Looks like this important bug fix is making it into 4.0 !
http://lucene.472066.n3.nabble.com/VOTE-release-4-0-take-two-tp4010808p4011255.html

On Oct 1, 2012, at 10:26 AM, David Smiley (@MITRE.org) wrote:


Hi Ere,

You are using it correctly.  The problem is this:
https://issues.apache.org/jira/browse/LUCENE-
Sadly, this just missed the 4.0 release which appears to be imminent.  If
the release needs to be respun then I'll get this simple fix in it.  Yeah
this sucks and it's very frustrating to me that it didn't make 4.0.  You
could check out either the 4.0 release branch and apply the patch, to get
this change now. As an alternative option, perhaps it would be useful if I
created a super simple plugin that wraps the existing field type but adds
the fix, to be used in the mean time until the next release.

Updating that wiki page is on the top of my priority list right now,
although I'm leaving to speak at a conference today and won't be back till
Wednesday.

p.s. Normally I respond to these spatial inquiries sooner but my Google
Alerts didn't pick it up yet, which is odd since you used all the right
keywords.

~ David



-
Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-4-spatial-queries-jts-and-polygons-tp4010469p4011202.html
Sent from the Solr - User mailing list archive at Nabble.com.





--
Ere Maijala (Mr.)
The National Library of Finland


Re: Solr 4 spatial queries, jts and polygons

2012-10-01 Thread David Smiley (@MITRE.org)
Hi Ere,

You are using it correctly.  The problem is this:
https://issues.apache.org/jira/browse/LUCENE-
Sadly, this just missed the 4.0 release which appears to be imminent.  If
the release needs to be respun then I'll get this simple fix in it.  Yeah
this sucks and it's very frustrating to me that it didn't make 4.0.  You
could check out either the 4.0 release branch and apply the patch, to get
this change now. As an alternative option, perhaps it would be useful if I
created a super simple plugin that wraps the existing field type but adds
the fix, to be used in the mean time until the next release.

Updating that wiki page is on the top of my priority list right now,
although I'm leaving to speak at a conference today and won't be back till
Wednesday.

p.s. Normally I respond to these spatial inquiries sooner but my Google
Alerts didn't pick it up yet, which is odd since you used all the right
keywords.

~ David



-
 Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-4-spatial-queries-jts-and-polygons-tp4010469p4011202.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr 4 spatial queries, jts and polygons

2012-10-01 Thread Smiley, David W.
Looks like this important bug fix is making it into 4.0 !
http://lucene.472066.n3.nabble.com/VOTE-release-4-0-take-two-tp4010808p4011255.html

On Oct 1, 2012, at 10:26 AM, David Smiley (@MITRE.org) wrote:

 Hi Ere,
 
 You are using it correctly.  The problem is this:
 https://issues.apache.org/jira/browse/LUCENE-
 Sadly, this just missed the 4.0 release which appears to be imminent.  If
 the release needs to be respun then I'll get this simple fix in it.  Yeah
 this sucks and it's very frustrating to me that it didn't make 4.0.  You
 could check out either the 4.0 release branch and apply the patch, to get
 this change now. As an alternative option, perhaps it would be useful if I
 created a super simple plugin that wraps the existing field type but adds
 the fix, to be used in the mean time until the next release.
 
 Updating that wiki page is on the top of my priority list right now,
 although I'm leaving to speak at a conference today and won't be back till
 Wednesday.
 
 p.s. Normally I respond to these spatial inquiries sooner but my Google
 Alerts didn't pick it up yet, which is odd since you used all the right
 keywords.
 
 ~ David
 
 
 
 -
 Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
 --
 View this message in context: 
 http://lucene.472066.n3.nabble.com/Solr-4-spatial-queries-jts-and-polygons-tp4010469p4011202.html
 Sent from the Solr - User mailing list archive at Nabble.com.



Solr 4 spatial queries, jts and polygons

2012-09-26 Thread Ere Maijala

Hi All,

I've been trying to get the brand new spatial search functionality 
working with Solr 4 snapshot apache-solr-4.1-2012-09-24_05-10-26 and 
also a trunk build from 22 Sep. I have added the jts and jts-io 
libraries and defined a field as follows:


fieldType name=geo class=solr.SpatialRecursivePrefixTreeFieldType 
spatialContextFactory=com.spatial4j.core.context.jts.JtsSpatialContextFactory 
units=degrees distErrPct=0.025 maxDistErr=0.09 /


[...]

dynamicField name=*_geo  type=geo  indexed=true stored=true 
multiValued=true /


There are no errors during Solr startup, and I can successfully index 
and search rectangles, but I can't get the polygon search to work. E.g. 
this search:


q=*:*fq=location_geo:%22Intersects%28POLYGON%28%28-10%2030,%20-40%2040,%20-10%20-20,%2040%2020,%200%200,%20-10%2030%29%29%29%22

Results in the following error:

Unable to read: POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 30))

The call stack implies that JTS is not being used:

com.spatial4j.core.exception.InvalidShapeException: Unable to read: 
POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 30))

at 
com.spatial4j.core.io.ShapeReadWriter.readShape(ShapeReadWriter.java:48)
	at 
org.apache.lucene.spatial.query.SpatialArgsParser.parse(SpatialArgsParser.java:89)
	at 
org.apache.solr.schema.AbstractSpatialFieldType.getFieldQuery(AbstractSpatialFieldType.java:170)
	at 
org.apache.solr.search.SolrQueryParser.getFieldQuery(SolrQueryParser.java:171)

[...]

As far as I can see, ShapeReadWriter in spatial4j doesn't support 
polygons, and JTS is needed for that. I've read 
http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4 (which is a 
bit vague and partly outdated) and some of the JIRA issues too (e.g. 
SOLR-3304, SOLR-2268, LUCENE-3795), but did not notice what I'm missing.


Any pointers or hints on what to do to make this work would be highly 
appreciated. Thanks!


Regards,
Ere

--
Ere Maijala (Mr.)
The National Library of Finland


Spatial queries

2010-03-23 Thread Jean-Sebastien Vachon
Hi All,

I am using the package from JTeam to perform spatial searches on my index. I'd 
like to know if it is possible
to build a query that uses multiple clauses. Here is an example:

q={!spatial lat=123 long=456 radius=10} OR {!spatial lat=111 long=222 
radius=20}title:java

Basically that would return all documents having the word java in the title 
field and that are either
within 10 miles from the first location OR 20 miles from the second.

I've made a few tries but it does not seem to be supported. I'm still wondering 
if it would make sense to support this kind of queries.

I could use multiple queries and merge the results myself but then I need some 
faceting.

Thanks