[ 
https://issues.apache.org/jira/browse/LUCENE-8522?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16639708#comment-16639708
 ] 

Karl Wright commented on LUCENE-8522:
-------------------------------------

[~ivera] It's actually in the GeoPolygonFactory contract that null is returned 
for polygons that cannot be constructed:

{code}
  /** Create a GeoPolygon using the specified points and holes, using order to 
determine
   * siding of the polygon.  Much like ESRI, this method uses clockwise to 
indicate the space
   * on the same side of the shape as being inside, and counter-clockwise to 
indicate the
   * space on the opposite side as being inside.
   * @param description describes the polygon and its associated holes.  If 
points go
   *  clockwise from a given pole, then that pole should be within the polygon. 
 If points go
   *  counter-clockwise, then that pole should be outside the polygon.
   * @param leniencyValue is the maximum distance (in units) that a point can 
be from the plane and still be considered as
   *  belonging to the plane.  Any value greater than zero may cause some of 
the provided points that are in fact outside
   *  the strict definition of co-planarity, but are within this distance, to 
be discarded for the purposes of creating a
   *  "safe" polygon.
   * @return a GeoPolygon corresponding to what was specified, or null if a 
valid polygon cannot be generated
   *  from this input.
   */
{code}

So I think we ought to leave this alone and change the spatial4j wrapper to 
throw the exception.


> Spatial: Polygon touching the negative boundaries of WGS84 fails on Solr
> ------------------------------------------------------------------------
>
>                 Key: LUCENE-8522
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8522
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: modules/spatial3d
>    Affects Versions: 7.4, 7.5
>            Reporter: Ema Panz
>            Assignee: Ignacio Vera
>            Priority: Critical
>
> When using the WGS84 coordinates system and querying with a polygon touching 
> one of the "negative" borders, Solr throws a "NullPointerException" error.
> The query is performed with the "intersect" function over a GeoJson polygon 
> specified with the coordinates:
> { "coordinates":[[[-180,90],[-180,-90],[180,-90],[180,90],[-180,90]]] }
>  
> The queried field has been defined as:
> {code:java}
> <fieldType name="geom"
>            class="solr.SpatialRecursivePrefixTreeFieldType"
>            spatialContextFactory="Geo3D"
>            geo="true"
>            planetModel="WGS84"
>            format="GeoJSON"
> />{code}
>  
> {code:java}
>     java.lang.NullPointerException
>     at 
> org.apache.lucene.spatial.spatial4j.Geo3dShape.getBoundingBox(Geo3dShape.java:114)
>     at 
> org.apache.lucene.spatial.query.SpatialArgs.calcDistanceFromErrPct(SpatialArgs.java:63)
>     at 
> org.apache.lucene.spatial.query.SpatialArgs.resolveDistErr(SpatialArgs.java:84)
>     at 
> org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy.makeQuery(RecursivePrefixTreeStrategy.java:182)
>     at 
> org.apache.solr.schema.AbstractSpatialFieldType.getQueryFromSpatialArgs(AbstractSpatialFieldType.java:368)
>     at 
> org.apache.solr.schema.AbstractSpatialFieldType.getFieldQuery(AbstractSpatialFieldType.java:340)
>     at 
> org.apache.solr.search.FieldQParserPlugin$1.parse(FieldQParserPlugin.java:45)
>     at org.apache.solr.search.QParser.getQuery(QParser.java:169)
>     at 
> org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:207)
>     at 
> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:272)
>     at 
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:199)
>     at org.apache.solr.core.SolrCore.execute(SolrCore.java:2539)
>     at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:709)
>     at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:515)
>     at 
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:377)
>     at 
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:323)
>     at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634)
>     at 
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
>     at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
>     at 
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
>     at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
>     at 
> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
>     at 
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
>     at 
> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
>     at 
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
>     at 
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
>     at 
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
>     at 
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
>     at 
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
>     at 
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
>     at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
>     at 
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219)
>     at 
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
>     at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
>     at org.eclipse.jetty.server.Server.handle(Server.java:531)
>     at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352)
>     at 
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
>     at 
> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281)
>     at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
>     at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
>     at 
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
>     at 
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
>     at 
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
>     at 
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
>     at 
> org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
>     at 
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:760)
>     at 
> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:678)
>     at java.lang.Thread.run(Thread.java:748){code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to