Javier Molina wrote
> 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

Due to the bug, the accuracy computing algorithm believes the width for both
of these is 0.  That algorithm also looks at the height, which is computed
correctly.  The greater of the height and width has a lot to do with the
accuracy, and thus the first example you gave has a tiny value which results
in accuracy so small it results in an OOM for what is actually a large
shape.  Your 2nd is tall enough that you didn't hit an OOM.  The bug is with
how the width is calculated.

The code in error is in SpatialArgs is the following:
    Rectangle bbox = shape.getBoundingBox();
    //The diagonal distance should be the same computed from any opposite
corner,
    // and this is the longest distance that might be occurring within the
shape.
    double diagonalDist = ctx.getDistCalc().distance(
        ctx.makePoint(bbox.getMinX(), bbox.getMinY()), bbox.getMaxX(),
bbox.getMaxY());
    return diagonalDist * 0.5 * distErrPct;

Hey Javier, FYI you may want to take a a look at BBoxStrategy, a spatial
strategy that only indexes rectangles.  It's on trunk but should port to 4x
trivially.  It has exact precision, unlike the PrefixTree based strategy
which approximates to a grid.  BBoxStrategy also has some nifty area overlap
relevancy calculations.

~ 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-tp4034928p4035372.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to