Re: overlapping latitudes/longitudes, I think it was a mixup of sentences. At the end you pointed out where the problem was.
After doing more testing I see the issue not only depends on the longitudes but it is also affected by latitudes. For example This very wide rectangle will cause an OutOfMemoryError -180 3 180 3.01666666666668 While this one, slightly taller will work fine. -180 3 180 3.5 But you probably already know that. Re: multivalued fields, I have never used one before, then I think I will just jump to the general documentation and also follow the code you posted. Thanks, Javier On 22 January 2013 13:17, David Smiley (@MITRE.org) <dsmi...@mitre.org>wrote: > Javier, > > I didn't point out anything about overlapping latitudes or longitudes. I > pointed out that your rectangle is extremely wide. It's 359.99999999999998 > degrees wide out of a maximum possibility of 360 even. That's wide! > Wether > it crosses the dateline or not doesn't trigger the bug; its triggered by > its > width being > 180 degrees, but is most severe the wider it is. You > probably > wouldn't have noticed this problem if the rect was "only" 300 degrees wide > or even a bit wider. > > There's nothing special about indexing a multi-valued field with spatial, > its the same as any other Solr multi-valued field. To split rectangles > that > have a width > 180, you could write a DIH Transformer or a Solr > UpdateRequestProcessor similarly. Here's an example I just did: > > public class SplitRectURPFactory extends > FieldMutatingUpdateProcessorFactory > { > > @Override > public UpdateRequestProcessor getInstance(SolrQueryRequest req, > SolrQueryResponse rsp, > UpdateRequestProcessor next) { > return new FieldValueMutatingUpdateProcessor(getSelector(), next) { > @Override > protected Object mutateValue(Object src) { > SpatialContext ctx = SpatialContext.GEO; > Rectangle rectangle = (Rectangle) ctx.readShape((String)src); > if (rectangle.getWidth() > 180) { > double minX = rectangle.getMinX(); > double midX = minX + rectangle.getWidth() / 2; > if (midX > 180) > midX -= 180; > double maxX = rectangle.getMaxX(); > Rectangle rect1 = ctx.makeRectangle(minX, midX, > rectangle.getMinY(), > rectangle.getMaxY()); > Rectangle rect2 = ctx.makeRectangle(midX, maxX, > rectangle.getMinY(), rectangle.getMaxY()); > src = Arrays.asList(rect1, rect2); > } > return src; > } > }; > } > } > > Of course ideally I should just go ahead and fix this bug ;-) > ~ David > > > Javier Molina wrote > > Thanks for your reply David. > > > > After doing more testing I found that overlapping latitudes or longitudes > > was not the issue as you point out. > > > > The values presented are extreme but they are correct, our solution > should > > allow a user to define a box in a map, a box crossing the 180 meridian is > > also valid. > > > > I know those are very extreme (and rare) scenarios but technically still > > valid ones. > > > > I understand your workaround and seems feasible but unfortunately I don't > > see any example on > > http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4on how to > > index a multivalued field. > > > > Is there any other documentation that I am missing? If not could you > > please > > shed some light on the syntax to index to boxes (rectangles) on a field? > > > > With regards to search, will an Intersects function behaviour will be OR, > > that is match any rectangle in my example on that multivalued field that > > intersects with the given area? > > > > Thanks, > > Javier > > > > > > > > > > > > On 22 January 2013 05:43, David Smiley (@MITRE.org) < > > > DSMILEY@ > > > >wrote: > > > >> Javier, > >> > >> Your minX is slightly greater than maxX, which is interpreted as a line > >> that > >> wraps nearly the entire globe. Is that what you intended? > >> > >> If this is what you intended, then you got bitten by this unfixed bug: > >> https://issues.apache.org/jira/browse/LUCENE-4550 > >> As a work-around, you could split that horizontal line into two equal > >> pieces > >> and index them as separate values for the document. > >> > >> ~ David > >> > > > > > > ----- > Author: > http://www.packtpub.com/apache-solr-3-enterprise-search-server/book > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Spatial-Dataimport-full-import-results-in-OutOfMemory-for-a-rectangle-defining-a-line-tp4034928p4035234.html > Sent from the Solr - User mailing list archive at Nabble.com. >