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

David Smiley commented on SOLR-6534:
------------------------------------

This issue can be left open I guess, or perhaps closed when query-time 
distErrPct becomes defaulted to 0 and/or ShapeCollection's bbox algorithm gets 
fixed.

Here's the unit test I added to RandomSpatialOpFuzzyPrefixTreeTest (not 
committed) to help diagnose the problem:
{code:java}
  @Test
  public void testSOLR6534() throws IOException, ParseException {
    JtsSpatialContextFactory factory = new JtsSpatialContextFactory();
    factory.datelineRule = JtsWktShapeParser.DatelineRule.ccwRect;
    //factory.wktShapeParserClass = JtsWKTReaderShapeParser.class;
    this.ctx = factory.newSpatialContext();
    this.grid = new GeohashPrefixTree(ctx, 11);
    this.strategy = new RecursivePrefixTreeStrategy(grid, 
getClass().getSimpleName());
//    Shape shape = ctx.readShapeFromWkt("GEOMETRYCOLLECTION(" +
//        "ENVELOPE(-3,4,8,2), ENVELOPE(-3,4,-4,-11)" +
//        ")");
    Shape queryShape = ctx.readShapeFromWkt("MULTIPOLYGON(" +
        "((-3 2,4 2,4 8,-3 8,-3 2)),((-3 -11,4 -11,4 -4,-3 -4,-3 -11))" +
        ")");
    final Rectangle indexedShape = ctx.makeRectangle(-9, -4, 3, 6);
    final SpatialOperation operation = SpatialOperation.Intersects;
    final boolean match = false;
//    testOperation(
//        indexedShape,
//        operation,
//        queryShape, false);
    //inline testOperation so we can set distErr
    adoc("0", indexedShape);
    commit();
    final SpatialArgs args = new SpatialArgs(operation, queryShape);
    args.setDistErr(0.0);
    Query query = strategy.makeQuery(args);
    SearchResults got = executeQuery(query, 1);
    assert got.numFound <= 1 : "unclean test env";
    if ((got.numFound == 1) != match)
      fail(operation+" I:" + indexedShape + " Q:" + queryShape);
    deleteAll();//clean up after ourselves
  }
{code}

> Multipolygon query problem with datelineRule=ccwRect
> ----------------------------------------------------
>
>                 Key: SOLR-6534
>                 URL: https://issues.apache.org/jira/browse/SOLR-6534
>             Project: Solr
>          Issue Type: Bug
>          Components: spatial
>    Affects Versions: 4.9
>         Environment: Windows 7, Oracle JDK 1.7.0_45
>            Reporter: Jon H
>            Assignee: David Smiley
>             Fix For: 5.0
>
>
> We are currently upgrading from Solr 4.1 to 4.9 and have observed some odd 
> behavior with multipolygon queries now. It is difficult to describe what is 
> happening so I took a screenshot with the documents and query area plotted on 
> a map. You can see it here: [http://imgur.com/iBpYLMh] The blue areas 
> represent the multipolygon and the purple areas represent the document 
> footprints.
> The query being used is as follows:
> {quote}
> geo:"Intersects(MULTIPOLYGON(((-3 2,4 2,4 8,-3 8,-3 2)),((-3 -11,4 -11,4 
> -4,-3 -4,-3 -11))))"
> {quote}
> This query returns all results when it should be returning only 8. If I run 
> two separate queries with each individual polygon, I get 4 hits each as 
> expected.
> I've narrowed this down to a problem with using 'datelineRule=ccwRect'. If I 
> remove this setting, the query returns with the expected results. 
> Unfortunately, this setting is required for our software though, since 
> handling large polygon queries (spanning >180 degrees) are a requirement.
> Here are the relevant schema details:
> {quote}
> <field name="geo" type="location_rpt" indexed="true" stored="false"/>
> <fieldType name="location_rpt" 
> class="solr.SpatialRecursivePrefixTreeFieldType" 
> spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
> geo="true" distErrPct="0.1" maxDistErr="0.000009" units="degrees"
> datelineRule="ccwRect" normWrapLongitude="true" autoIndex="true"/>
> {quote}



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

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

Reply via email to