You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "David Smiley (JIRA)" <ji...@apache.org> on 2016/05/18 21:04:12 UTC

[jira] [Reopened] (SOLR-8859) AbstractSpatialFieldType can use ShapeContext to read/write shapes (WKT, GeoJSON)

     [ https://issues.apache.org/jira/browse/SOLR-8859?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Smiley reopened SOLR-8859:
--------------------------------

While looking at the code for this again, I saw a couple problems, which I verified through the debugger.

The former behavior used to support 2 formats:  "lat,lon" and WKT, and it did this very efficiently -- it could tell it's WKT immediately and if not it parsed using SpatialUtils.parsePointSolrException (the lat,lon format).  

Now, it'll use the Spatial4j shapeReader configured, which if not configured (true for existing configs and I suspect for the majority of folks going forward still?) it'll be arbitrarily the first one.  By coincidence that's GeoJSON.  No matter what it is, however, parseShape will try all ShapeReaders in Spatial4j registered with the SpatialContext.  This even includes, sadly, LegacyShapeReader which parses "lat,lon" and some stuff like "Circle(x y d=dist)" that we stopped supporting many releases ago.  Some of these readIfSupported impls throw exceptions to signal they don't support it.  So in summary, (1) this is slow, and (2) IMO if you configure= format X then we should only parse as format X.  I have reservations about the notion of cycling through all formats to see what it is.

RptWithGeometrySpatialField.init doesn't call super.init and thus the shapeReader & shapeWriter isn't initialized.  That's perhaps not a bug in this issue but it was a non-issue before and now it is.  It's a challenging conundrum; ideally it would but I had difficulty with a cach-22 of extending it and also supplying it to CompositeSpatialStrategy.  I can revisit that in a separate issue.

> AbstractSpatialFieldType can use ShapeContext to read/write shapes (WKT, GeoJSON)
> ---------------------------------------------------------------------------------
>
>                 Key: SOLR-8859
>                 URL: https://issues.apache.org/jira/browse/SOLR-8859
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Ryan McKinley
>            Assignee: Ryan McKinley
>            Priority: Minor
>             Fix For: 6.1, master (7.0)
>
>         Attachments: SOLR-8859.patch
>
>
> Right now the AbstractSpatialFieldType throws exceptions if it needs to convert to/from a string.  We should use the context to convert



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org