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 mathaix <mm...@placester.com> on 2014/12/10 21:09:17 UTC

Solr Error when making GeoPrefixTree polygon filter search

I am try to make a solr query using the following filter. 
location_rpt:"IsWithin( POLYGON((-122.42048263549805 37.79762790889688,
-122.42048263549805 37.787860934698, -122.44726181030273 37.787860934698,
-122.44726181030273 37.79762790889688, -122.42048263549805
37.79762790889688)) ) distErrPct=0"

However Solr (4.10.2) is throwing the following errors:
7518984 [qtp689386811-15] INFO  org.apache.solr.core.SolrCore  – [sfgate]
webapp=/solr path=/select
params={fl=id,locality,neighborhood&indent=true&q=*.*&_=1418241499252&wt=json&fq=location_rpt:"IsWithin(POLYGON((-122.42048263549805+37.79762790889688,-122.42048263549805+37.787860934698,-122.44726181030273+37.787860934698,-122.44726181030273+37.79762790889688,-122.42048263549805+37.79762790889688)))+distErrPct%3D0"}
status=400 QTime=7 
7698784 [qtp689386811-16] ERROR org.apache.solr.core.SolrCore  –
org.apache.solr.common.SolrException: Couldn't parse shape
'POLYGON((-122.42048263549805 37.79762790889688, -122.42048263549805
37.787860934698, -122.44726181030273 37.787860934698, -122.44726181030273
37.79762790889688, -122.42048263549805 37.79762790889688))' because: Unknown
Shape definition [POLYGON((-122.42048263549805 37.79762790889688,
-122.42048263549805 37.787860934698, -122.44726181030273 37.787860934698,
-12...]
	at
org.apache.solr.schema.AbstractSpatialFieldType.parseShape(AbstractSpatialFieldType.java:175)
	at
org.apache.solr.schema.AbstractSpatialFieldType$1.parseShape(AbstractSpatialFieldType.java:117)
	at
org.apache.lucene.spatial.query.SpatialArgsParser.parse(SpatialArgsParser.java:90)
	at
org.apache.solr.schema.AbstractSpatialFieldType.parseSpatialArgs(AbstractSpatialFieldType.java:253)
	at
org.apache.solr.schema.AbstractSpatialFieldType.getFieldQuery(AbstractSpatialFieldType.java:248)
	at
org.apache.solr.parser.SolrQueryParserBase.getFieldQuery(SolrQueryParserBase.java:737)
	at
org.apache.solr.parser.SolrQueryParserBase.getFieldQuery(SolrQueryParserBase.java:387)
	at
org.apache.solr.parser.SolrQueryParserBase.handleQuotedTerm(SolrQueryParserBase.java:555)
	at org.apache.solr.parser.QueryParser.Term(QueryParser.java:403)
	at org.apache.solr.parser.QueryParser.Clause(QueryParser.java:185)
	at org.apache.solr.parser.QueryParser.Query(QueryParser.java:107)
	at org.apache.solr.parser.QueryParser.TopLevelQuery(QueryParser.java:96)
	at
org.apache.solr.parser.SolrQueryParserBase.parse(SolrQueryParserBase.java:151)
	at org.apache.solr.search.LuceneQParser.parse(LuceneQParser.java:50)
	at org.apache.solr.search.QParser.getQuery(QParser.java:141)
	at
org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:194)
	at
org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:197)
	at
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
	at org.apache.solr.core.SolrCore.execute(SolrCore.java:1967)
	at
org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:777)
	at
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:418)
	at
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:207)
	at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419)
	at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
	at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
	at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
	at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
	at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)
	at
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)
	at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
	at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009)
	at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
	at
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
	at
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
	at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
	at org.eclipse.jetty.server.Server.handle(Server.java:368)
	at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
	at
org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)
	at
org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:942)
	at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1004)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:640)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
	at
org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)
	at
org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)
	at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
	at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.text.ParseException: Unknown Shape definition
[POLYGON((-122.42048263549805 37.79762790889688, -122.42048263549805
37.787860934698, -122.44726181030273 37.787860934698, -12...]
	at com.spatial4j.core.io.WktShapeParser.parse(WktShapeParser.java:90)
	at
com.spatial4j.core.context.SpatialContext.readShapeFromWkt(SpatialContext.java:294)
	at
org.apache.solr.schema.AbstractSpatialFieldType.parseShape(AbstractSpatialFieldType.java:170)
	... 46 more


Any help on this would be appreciated. 


thanks,

Mathew




--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Error-when-making-GeoPrefixTree-polygon-filter-search-tp4173629.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Error when making GeoPrefixTree polygon filter search

Posted by "david.w.smiley@gmail.com" <da...@gmail.com>.
As in the layout shipped with Solr?  Try putting the JTS ‘jar’ in lib/ext
and let us know if that worked.  I think it will but I forget.

~ David Smiley
Freelance Apache Lucene/Solr Search Consultant/Developer
http://www.linkedin.com/in/davidwsmiley

On Thu, Dec 11, 2014 at 12:40 PM, mathaix <mm...@placester.com> wrote:
>
> Thank you. That was the issue.
> Is am running solr with Jetty. Is there are recommended way for including
> those jars in the jetty configuration?
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-Error-when-making-GeoPrefixTree-polygon-filter-search-tp4173629p4173807.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Solr Error when making GeoPrefixTree polygon filter search

Posted by mathaix <mm...@placester.com>.
Thank you. That was the issue. 
Is am running solr with Jetty. Is there are recommended way for including
those jars in the jetty configuration?



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Error-when-making-GeoPrefixTree-polygon-filter-search-tp4173629p4173807.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Error when making GeoPrefixTree polygon filter search

Posted by Guido Medina <gu...@temetra.com>.
Hi Mathaix,

David could be right, we have geo-polygons and stuff and what we do is 
that we put the JTS jar inside solr.war (and other jars using our own 
automated scripts to add extra jars inside it)

Here is the link of latest maven JTS dependency where you can download 
it directly:

http://search.maven.org/#artifactdetails|com.vividsolutions|jts|1.13|jar

HTH,

Guido.

On 10/12/14 22:27, david.w.smiley@gmail.com wrote:
> Mathaix,
> I bet you don’t have JTS on your classpath.  See the spatial page in the
> Solr ref guide.
>
> ~ David Smiley
> Freelance Apache Lucene/Solr Search Consultant/Developer
> http://www.linkedin.com/in/davidwsmiley
>
> On Wed, Dec 10, 2014 at 4:50 PM, mathaix <mm...@placester.com> wrote:
>
>> So I downloaded and attached the spatial4j source. (where it is breaking).
>> Notice that there is no POLYGON type in the WktShapeParser file.
>>
>> (See attached source).
>>
>> https://github.com/spatial4j/spatial4j/blob/master/src/main/java/com/spatial4j/core/io/WktShapeParser.java
>>
>>
>>
>> --
>> View this message in context:
>> http://lucene.472066.n3.nabble.com/Solr-Error-when-making-GeoPrefixTree-polygon-filter-search-tp4173629p4173650.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>


Re: Solr Error when making GeoPrefixTree polygon filter search

Posted by "david.w.smiley@gmail.com" <da...@gmail.com>.
Mathaix,
I bet you don’t have JTS on your classpath.  See the spatial page in the
Solr ref guide.

~ David Smiley
Freelance Apache Lucene/Solr Search Consultant/Developer
http://www.linkedin.com/in/davidwsmiley

On Wed, Dec 10, 2014 at 4:50 PM, mathaix <mm...@placester.com> wrote:

> So I downloaded and attached the spatial4j source. (where it is breaking).
> Notice that there is no POLYGON type in the WktShapeParser file.
>
> (See attached source).
>
> https://github.com/spatial4j/spatial4j/blob/master/src/main/java/com/spatial4j/core/io/WktShapeParser.java
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-Error-when-making-GeoPrefixTree-polygon-filter-search-tp4173629p4173650.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Solr Error when making GeoPrefixTree polygon filter search

Posted by mathaix <mm...@placester.com>.
So I downloaded and attached the spatial4j source. (where it is breaking). 
Notice that there is no POLYGON type in the WktShapeParser file. 

(See attached source). 
https://github.com/spatial4j/spatial4j/blob/master/src/main/java/com/spatial4j/core/io/WktShapeParser.java



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Error-when-making-GeoPrefixTree-polygon-filter-search-tp4173629p4173650.html
Sent from the Solr - User mailing list archive at Nabble.com.