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

David Smiley commented on LUCENE-4978:
--------------------------------------

The offending code is the implementation of IntersectsPrefixTreeFilter's 
VisitorTemplate.visitScanned:
{code:java}
        if (cell.getLevel() == grid.getMaxLevels() && !cell.isLeaf())
          cShape = cell.getCenter();
        else
          cShape = cell.getShape();
        if (queryShape.relate(cShape).intersects())
          collectDocs(results);
{code}

What's going on here is a performance optimization to use a point for the 
intersection instead of a rectangle.  I never measured the before-after effect, 
and I'm not sure if I even thought of it in terms of a performance optimization 
in the first place although that's what it is.

One possible solution is to see if the query shape is a rectangle or circle; if 
so then buffer the query shape by 1/2 a grid cell, which is enough to eliminate 
the possibility of a false-negative. If it's another shape (whether it be a 
point or a polygon) then use the cell's rect instead of its center point.
                
> Spatial search with point query won't find identical indexed point
> ------------------------------------------------------------------
>
>                 Key: LUCENE-4978
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4978
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: modules/spatial
>    Affects Versions: 4.1
>            Reporter: David Smiley
>            Assignee: David Smiley
>            Priority: Minor
>
> Given a document with indexed POINT (10 20), when a search for INTERSECTS( 
> POINT (10 20)) is issued, no results are returned.
> The work-around is to not search with a point shape, use a very small-radius 
> circle or rectangle.  (I'm marking this issue as "minor" because it's easy to 
> do this).
> An unstated objective of the PrefixTree/grid approximation is that no matter 
> what precision you use, an intersects query will find all true-positives.  
> Due to approximations, it may also find some close false-positives.  But in 
> the case above, that unstated promise is violated.  But it can also happen 
> for query shapes other than points which do in fact barely enclose the point 
> given at index time yet the indexed point is in-effect shifted to the center 
> point of a cell which could be outside the query shape, and ultimately 
> leading to a false-negative.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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

Reply via email to