[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13423072#comment-13423072 ] David Smiley commented on LUCENE-4167: -- I spent some time working on TwoDoublesStrategy to make it not use makeQuery and to simplify it and fix the dateline bug. Then it a realization hit me: if makeQuery() goes away (the default impl gets used) and the input is a circle and sorting is desired, the distances will wind up getting calculated twice. The first is for the filter, the 2nd is makeDistanceValueSource called via default impl of makeQuery(). I still think makeQuery() should go away, albeit I have less conviction about that now. Remember my suggestion of having some sort of object which I proposed be called SpatialSearch that is returned from a method on the strategy? This would have a makeFilter() and makeDistanceValueSource() instead of them being directly on the strategy. The SpatialSearch instance is per-search and affords the opportunity to cache intermediate results across method calls. Ryan told me about wanting to do this for a specialized use-case he has with JtsStrategy (in Spatial4j right now) where he unfortunately resorts to a ThreadLocal work-around to share the results. I can also imagine a sort strategy for RecursivePrefixTreeStrategy in which the filter is informed it should calculate matching distances in addition to its filtering job, so that they can be retrieved later. Of course the filtering would be slower the more points that are covered by the search radius, but it's viable for some use-cases. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Core Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch, LUCENE-4167_migrate_com_spatial4j_core_query_to_Lucene_spatial.patch, LUCENE-4167_migrate_com_spatial4j_core_query_to_Lucene_spatial.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13423636#comment-13423636 ] David Smiley commented on LUCENE-4167: -- We concluded in private chat that the status quo is probably best right now. That is, makeQuery() stays, so that it affords the opportunity for internal efficiencies when doing a combined filter sort. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Core Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch, LUCENE-4167_migrate_com_spatial4j_core_query_to_Lucene_spatial.patch, LUCENE-4167_migrate_com_spatial4j_core_query_to_Lucene_spatial.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13421987#comment-13421987 ] Chris Male commented on LUCENE-4167: I think somewhere along the lines we lost track of the original purpose of this issue, removing SpatialOperation. Originally I strongly pushed to remove SpatialOperation and use strongly typed methods. But after considering that a little and dabbling in adding operations to some Strategies, I'm unsure how effective it would be. Requiring an interface per operation seems heavy handed since inevitably the consumer will interact with a Strategy instance, not a ContainsXYZ instance. Equally, having a makeXYZFilter method for each operation in Strategy would seem to simply move the problem rather than address it since many Strategies won't be implementing all the operations (meaning they'll have to throw an UOE) while other Strategies will be implementing many operations. As such I withdraw my interest in removing SpatialOperation and instead think we need to focus on documentation to make it clear to consumers which Strategies fit their needs. I'll extract some of the other improvements discussed here and spin them off as issues. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Core Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch, LUCENE-4167_migrate_com_spatial4j_core_query_to_Lucene_spatial.patch, LUCENE-4167_migrate_com_spatial4j_core_query_to_Lucene_spatial.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13415154#comment-13415154 ] David Smiley commented on LUCENE-4167: -- bq. We can maybe move the makeQuery as you defined to a utility class (maybe with the stored-field stuff) which focuses on providing an easy API for the 90% of use cases. Why not just a static method on Strategy? I'm not sure there is much need for a utility class yet. bq. Can we rename makeValueSource to makeDistanceValueSource so that it is clearer what it does? I'm not really sure how best to handle ValueSources calculating scores from other factors just yet so lets just put that on the backburner. +1 my first reaction is that I love it, but I have a few questions: * What should BBoxStrategy do? It's very existence is largely due to its overlap percentage based relevancy -- pretty cool. Would it have a makeDistanceValueSource() that does something different? -- perhaps one that gets the center of the indexed shape and uses that? It could work via new BBoxSimilarityValueSource(CenterDistanceSimilarity(...)) (hypothetical implementation to be developed). And the current one might be makeCustomValueSource with the ability for the caller to pass in AreaSimilarity() * Would a makeDistanceValueSource() make it inefficient to support an inverted distance? This may be a stupid question but we ultimately want this as the default for a query: LUCENE-4208 -- for example at the Solr layer. bq. So how about we rename SpatialArgs to SpatialCommand? Okay I guess. How about SpatialQueryCommand or SpatialArgsCommand? Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch, LUCENE-4167_migrate_com_spatial4j_core_query_to_Lucene_spatial.patch, LUCENE-4167_migrate_com_spatial4j_core_query_to_Lucene_spatial.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13415180#comment-13415180 ] Chris Male commented on LUCENE-4167: bq. Why not just a static method on Strategy? I'm not sure there is much need for a utility class yet. My problem with this and with having the stored-field stuff as static methods too, is that having them on Strategy is that it seems that they are the only/preferred/recommended way to do something and I don't feel that's the case. Instead they are methods which we think do a good job in a certain selection of use cases, possibly even the majority of use cases. I don't want users to get the wrong idea. bq. What should BBoxStrategy do? It's very existence is largely due to its overlap percentage based relevancy – pretty cool. Would it have a makeDistanceValueSource() that does something different? – perhaps one that gets the center of the indexed shape and uses that? It could work via new BBoxSimilarityValueSource(CenterDistanceSimilarity(...)) (hypothetical implementation to be developed). And the current one might be makeCustomValueSource with the ability for the caller to pass in AreaSimilarity() Yeah this is difficult but I like the idea of makeCustomValueSource. I don't know much about BBoxStrategy but as long as it is possible to calculate the distance between the centre of two BBoxes, then we should be fine with makeDistanceValueSource, right? We can then document makeCustomValueSource as being a generic method which Strategys may define custom behavior for (we can perhaps have it default to just calling makeDistanceValueSource). If we get to a situation where we have another Strategy-wide ValueSource idea, we can then spin that off into another makeXXXValueSource method. bq. Would a makeDistanceValueSource() make it inefficient to support an inverted distance? This may be a stupid question but we ultimately want this as the default for a query: LUCENE-4208 – for example at the Solr layer. We can have the DistanceCalculator or whatever is used to calculate the distance, return the inverted distance. Certainly wrapping a ValueSource in _another_ ValueSource just to invert the distance would be inefficient. bq. Okay I guess. How about SpatialQueryCommand or SpatialArgsCommand? I like SpatialQueryCommand. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch, LUCENE-4167_migrate_com_spatial4j_core_query_to_Lucene_spatial.patch, LUCENE-4167_migrate_com_spatial4j_core_query_to_Lucene_spatial.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13415199#comment-13415199 ] David Smiley commented on LUCENE-4167: -- Keeping score... we're +1 for makeQuery() going away. Nice. bq. My problem with this and with having the stored-field stuff as static methods too, is that having them on Strategy it seems that they are the only/preferred/recommended way to do something and I don't feel that's the case. Okay then. So a SpatialUtil class with a private no-arg constructor with static methods? bq. then we should be fine with makeDistanceValueSource, right? Yes, it is totally do-able with BBoxStrategy and should in theory be for any Strategy. Until someone has the time to do it for BBoxStrategy (should be easy) it could throw an UnsupportedOperationException. By the way, I was not suggesting makeCustomValueSource() be on the Strategy API, it would be specific to BBoxStrategy. bq. We can have the DistanceCalculator or whatever is used to calculate the distance, return the inverted distance. So... are we then talking about a makeInvertedDistanceValueSource() method? Hmm, this is somewhat less satisfying. Perhaps instead a boolean argument to invert it? bq. I like SpatialQueryCommand. Good; lets do it. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch, LUCENE-4167_migrate_com_spatial4j_core_query_to_Lucene_spatial.patch, LUCENE-4167_migrate_com_spatial4j_core_query_to_Lucene_spatial.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13415206#comment-13415206 ] Chris Male commented on LUCENE-4167: bq. Okay then. So a SpatialUtil class with a private no-arg constructor with static methods? Yeah something like that. bq. By the way, I was not suggesting makeCustomValueSource() be on the Strategy API, it would be specific to BBoxStrategy. Ah okay. Perhaps we can call it makeOverlapValueSource() then? if that's what the value is bq. So... are we then talking about a makeInvertedDistanceValueSource() method? Hmm, this is somewhat less satisfying. Perhaps instead a boolean argument to invert it? No I don't think we need to call it that or make the differentiation. Our makeDistanceValueSource() should return the inverted distance since it's arguably more useful. If people want the original distance (maybe for display sake) then they can un-invert it themselves. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch, LUCENE-4167_migrate_com_spatial4j_core_query_to_Lucene_spatial.patch, LUCENE-4167_migrate_com_spatial4j_core_query_to_Lucene_spatial.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13414857#comment-13414857 ] Chris Male commented on LUCENE-4167: Okay I'm going to try to find some middle ground here so we can move forward: bq. Here's an idea: what if makeQuery() goes away? Why is it needed when it can be constructed by a client quite simply like it is now: +1. The score for spatial Documents seems like it could be calculated from a variety of factors. One of those factors could be distance, another could be overlap percentage. So using ValueSource with FunctionQuery seems to give us maximum flexibility. We can maybe move the makeQuery as you defined to a utility class (maybe with the stored-field stuff) which focuses on providing an easy API for the 90% of use cases. Can we rename makeValueSource to makeDistanceValueSource so that it is clearer what it does? I'm not really sure how best to handle ValueSources calculating scores from other factors just yet so lets just put that on the backburner. This leaves us with only needing makeXXXFilter for each Operation. I like Ryan's suggestion of using the XXXFilterBuilder interfaces. It doesn't seem like a huge overhead for Strategys that share logic between operations to have to implement a method and call another, 3 lines at the most. Reasonable? bq. The command pattern isn't a hack, I find it rather appropriate in this case, and I remember thinking it was a brilliant move by Ryan to have used it when I first saw it in Strategy for the first time. The distance precision is kind of a hint that is optional. On the other hand, the shape operation are fundamental I can see situations whereby we do have a mix of required parameters (such as Shape, field name) and some that are optional and only apply to certain Strategys. So how about we rename SpatialArgs to SpatialCommand? and we document that we will treat changes to SpatialCommand like we would to the Strategy APIs, i.e. we won't be removing / changing things without consideration. Having the Command also means we can handle bw compat more I guess. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch, LUCENE-4167_migrate_com_spatial4j_core_query_to_Lucene_spatial.patch, LUCENE-4167_migrate_com_spatial4j_core_query_to_Lucene_spatial.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13402883#comment-13402883 ] Ryan McKinley commented on LUCENE-4167: --- This is essentially a java API vs 'query string' question. As is we essentially pass the query string all the way to the SpatialStrategy before it checks the operation; Chris proposes that the operation should be parsed *before* it gets to the strategy and have real java functions for each operation. I support: * removing the make* functions from SpatialStrategy * for each possible strategy, we would create an interface like: {code:java} interface IntersectsSpatialQueryBuilder { public Query makeIntersectsQuery(SpatialArgs args); public Filter makeIntersectsFilter(SpatialArgs args); } interface IsWithinSpatialQueryBuilder { public Query makeIsWithinQuery(SpatialArgs args); public Filter makeIsWithinFilter(SpatialArgs args); } {code} and then concrete SpatialStrategy implementations would implement everything they can do. This may be just Intersects, or it may be a list of 10 things it can do. The advantage to this approach would be: * clear java API and good place in javadocs to give the inevitable caveats for the operation implementation details * testing can check for instances of 'IsWithinSpatialQueryBuilder' The end user query string can still look like INTERSECTS( ) but this would let us take that parsing out of the indexing class. - - - - I'm going to go ahead and push the BBox strategy into trunk because it is a strategy with a bunch of operations, and i want to make sure general operations remain a top level concept. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13402888#comment-13402888 ] David Smiley commented on LUCENE-4167: -- Thanks for your input Ryan. bq. Chris proposes that the operation should be parsed before it gets to the strategy and have real java functions for each operation. makeFilter makeQuery receives a SpatialArgs object which has already been parsed; it's not a string anymore. (The Command design pattern, by the way). And he's also proposing that SpatialArgs is gone, at least from these methods, and instead you get a Shape + distancePrecision pair of args. Somewhat related to this is the Filter/Query distinction. Minutes ago I had the realization that makeQuery() could have a fixed implementation based on makeFilter() with makeValueSource() (for the distance). It's already committed so you can see. Assuming you also think it makes a good default implementation, this suggests any variety of makeQuery would call the same method, which seems less than ideal but not terrible. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13403055#comment-13403055 ] Chris Male commented on LUCENE-4167: {quote} makeFilter makeQuery receives a SpatialArgs object which has already been parsed; it's not a string anymore. (The Command design pattern, by the way). And he's also proposing that SpatialArgs is gone, at least from these methods, and instead you get a Shape + distancePrecision pair of args. {quote} I gather you don't like that idea, it reads that way at least. We don't need SpatialArgs at the moment. It feels like a hack to allow us to add whatever arguments we want without having to change method signature and so we can have some defaults. The Strategy API should be explicit so users know exactly what they need to provide (distance precision is used in both of the PrefixTreeStrategys, it is important) and we should consider any changes to the API very carefully. This API shouldnt have any mystery or surprises, it should be extremely clear to what user what to expect. I cannot stress this enough. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13403056#comment-13403056 ] Chris Male commented on LUCENE-4167: {quote} This is essentially a java API vs 'query string' question. As is we essentially pass the query string all the way to the SpatialStrategy before it checks the operation; Chris proposes that the operation should be parsed before it gets to the strategy and have real java functions for each operation. {quote} This is exactly what I'm suggesting. The Strategys shouldn't be doing decision making, they are Factorys. The logic for parsing queries, validating, choosing Strategys, constructing Shapes and identifying operations, shouldn't be their concern at all. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13403059#comment-13403059 ] Chris Male commented on LUCENE-4167: {quote} Somewhat related to this is the Filter/Query distinction. Minutes ago I had the realization that makeQuery() could have a fixed implementation based on makeFilter() with makeValueSource() (for the distance). It's already committed so you can see. Assuming you also think it makes a good default implementation, this suggests any variety of makeQuery would call the same method, which seems less than ideal but not terrible. {quote} Now I think about it, what exactly are the purposes of makeQuery and makeValueSource()? I don't think it's clear. Does makeQuery() have to score the same Documents as makeFilter() identifies? We don't verify that they do. What does the score for makeQuery() mean? Is it always the distance between the centre of two Shapes? I can think of a IsDisJoint scenario where the two Shapes are disjoint but they have the same central point. Consequently is the score related to the operation? What is makeValueSource() all about then? does it return the same score for the same Document as makeQuery() just doesn't do any filtering as well? Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13403181#comment-13403181 ] David Smiley commented on LUCENE-4167: -- bq. We don't need SpatialArgs at the moment. It feels like a hack to allow us to add whatever arguments we want without having to change method signature and so we can have some defaults. The command pattern isn't a hack, I find it rather appropriate in this case, and I remember thinking it was a brilliant move by Ryan to have used it when I first saw it in Strategy for the first time. The distance precision is kind of a hint that is optional. On the other hand, the shape operation are fundamental. I agree putting the operation into the method name does indeed make it clear which operations are supported, which is good for clarity and compile-time safety. But the compile-time safety is only realized if used directly by client code, not when the client is remote and passes a query string that is parsed and evaluated against a Strategy. This is what happens in Solr, in some of our testing, and I expect similarly for potential users like ElasticSearch when that eventually happens. Curious, how do you propose compile-time safety be added to see what shape(s) a Strategy indexes? And what about multi-value compile-time checks? bq. Now I think about it, what exactly are the purposes of makeQuery and makeValueSource()? I don't think it's clear. I'll copy-paste the javadocs for you here: {code:java} /** * Make a query which has a score based on the distance from the data to the query shape. * The default implementation constructs a {@link FilteredQuery} based on * {@link #makeFilter(com.spatial4j.core.query.SpatialArgs, SpatialFieldInfo)} and * {@link #makeValueSource(com.spatial4j.core.query.SpatialArgs, SpatialFieldInfo)}. */ public Query makeQuery(SpatialArgs args, T fieldInfo) { {code} {code:java} /** * The value source yields a number that is proportional to the distance between the query shape and indexed data. * @param args * @param fieldInfo */ public abstract ValueSource makeValueSource(SpatialArgs args, T fieldInfo); {code} You rightly point out that the javadocs for makeValueSource is a bit vague. I thought it would be best to leave some wiggle room for different ways of calculating the distance instead of being precise. Do you think we should spell it out exactly and thus leave no room for alternatives? In terms of its relationship with makeQuery(), I think it makes sense to effectively fix the Strategy specification to essentially be what makeQuery()'s default impl does now (now as of last night anyway). So yes, the filter query's matching documents should always be the same. Adding documentation to this affect would be good; one has to infer that at the moment based on the existing docs. Here's an idea: what if makeQuery() goes away? Why is it needed when it can be constructed by a client quite simply like it is now: {code:java} public Query makeQuery(SpatialArgs args, T fieldInfo) { Filter filter = makeFilter(args, fieldInfo); ValueSource vs = makeValueSource(args, fieldInfo); return new FilteredQuery(new FunctionQuery(vs), filter); } {code} If it goes away, my acceptance level of putting the operation name into the method would be higher since you'd only have makeFilter without a Query variant. {code} Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands,
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13403444#comment-13403444 ] David Smiley commented on LUCENE-4167: -- Shall I move com.spatial4j.core.query.* into Lucene spatial now or will that create too many conflicts with your patch, Chris? Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13403642#comment-13403642 ] Chris Male commented on LUCENE-4167: I don't see consensus being reached on how the Strategy API should look so I'm going to leave the patch. Go ahead and do your moves. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13402274#comment-13402274 ] David Smiley commented on LUCENE-4167: -- I agree with your complaint. The only two supported operations are: * Intersects -- equivalent to IsWithin when index data is points * BBoxWIntersects -- again, equivalent to BBoxIsWithin when the indexed data is points. The distinction of overlaps with intersects seems dubious. The bbox handling is universally handled in SpatialArgs.getShape() which checks the operation and returns the wrapping rectangle. So effectively the strategies need not even bother with the whole SpatialOperation concept, at least not at the moment. My concern with your suggestion to remove SpatialOperation is that I do think it will return. I know I want to work on an IsWithin when indexed data is shapes with area. And it is serving the purpose of SpatialArgsParser parsing out the operation you want to do, which I don't think should go away (i.e. the query string shouldn't assume an intersect, it should include Intersects(...) Perhaps the unsupported operations could be commented out? Separately, I think com.spatial4j.core.query.* belongs in Lucene spatial. It's not used by any of the rest of Spatial4j, yet it's tightly related to the concept of querying which is Lucene spatial's business, and is not the business of Spatial4j. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13402286#comment-13402286 ] Chris Male commented on LUCENE-4167: {quote} Intersects – equivalent to IsWithin when index data is points BBoxWIntersects – again, equivalent to BBoxIsWithin when the indexed data is points. {quote} I don't see the need to differentiate BBoxIntersects and Intersects. If the user wants to find those Documents related to the bounding box of a Shape, then they can call shape.getBoundingBox() and pass that into the Strategy. The Strategys shouldn't have to worry about the Shape (although TwoDoubles does but that needs to be re-thought separately). The Strategys should just take the Shape given and roll with it. Is that what you're suggesting? {quote} My concern with your suggestion to remove SpatialOperation is that I do think it will return. I know I want to work on an IsWithin when indexed data is shapes with area. And it is serving the purpose of SpatialArgsParser parsing out the operation you want to do, which I don't think should go away (i.e. the query string shouldn't assume an intersect, it should include Intersects(...) Perhaps the unsupported operations could be commented out? {quote} I can see the need for different behaviour for different Shape relationships to. But I think we should perhaps do that using method specialization. We already have the PrefixTreeStrategy abstraction, so you could write a WithinRecursivePrefixTreeStrategy which specialized makeQuery differently. That way it is clear to the user what the Strategy does, we won't need the runtime checks and we won't have Strategys like TwoDoubles which has methods for each of the different behaviours in the same class. So I think we can remove the need for SpatialOperation now and support the idea differently in the future. (As a side note, this actually makes me think we should decouple the indexing code of Strategys from the querying code). {quote} Separately, I think com.spatial4j.core.query.* belongs in Lucene spatial. It's not used by any of the rest of Spatial4j, yet it's tightly related to the concept of querying which is Lucene spatial's business, and is not the business of Spatial4j. {quote} +1. As a short term solution I think we just replicate the code that we need in Lucene now and then drop it from Spatial4J in the next release. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13402531#comment-13402531 ] David Smiley commented on LUCENE-4167: -- bq. I don't see the need to differentiate BBoxIntersects and Intersects. If the user wants to find those Documents related to the bounding box of a Shape, then they can call shape.getBoundingBox() and pass that into the Strategy. The Strategys shouldn't have to worry about the Shape (although TwoDoubles does but that needs to be re-thought separately). The Strategys should just take the Shape given and roll with it. Is that what you're suggesting? The stategy shouldn't care about the bbox concept, I agree. I think the bbox capability should be decoupled from SpatialOperation. It's not a simple matter of the client calling queryShape.getBoundingBox() since the expression of the query shape from client to server is a string. So instead of BBoxIntersects(Circle(3,5 d=10)) I propose supporting INTERSECTS(BBOX(Circle(3,5 d=10))). The actual set of operations I want to support are [E]CQL spatial predicates: http://docs.geoserver.org/latest/en/user/filter/ecql_reference.html#spatial-predicate but that perhaps deserves its own issue. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13402591#comment-13402591 ] David Smiley commented on LUCENE-4167: -- bq. I can see the need for different behaviour for different Shape relationships to. But I think we should perhaps do that using method specialization. We already have the PrefixTreeStrategy abstraction, so you could write a WithinRecursivePrefixTreeStrategy which specialized makeQuery differently. That way it is clear to the user what the Strategy does, we won't need the runtime checks and we won't have Strategys like TwoDoubles which has methods for each of the different behaviours in the same class. Sorry, but I disagree with your point of view. The Strategy is supposed to be a single facade to the implementation details of how a query will work, including the various possible spatial predicates (i.e. spatial operations) that is supports. If one Java class file shows that it becomes too complicated and it would be better separated because implementing different predicates are just so fundamentally different, then then the operations could be decomposed to separate source files but it would be behind the facade of the Strategy. I don't believe that TwoDoublesStrategy demonstrates complexity of a class trying to do too many things. I absolutely think TwoDoublesStrategy could be coded to be more clear. If it is as buggy/untested as I think it is and nobody wants to fix it (I don't), personally I think this strategy can go away. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13402783#comment-13402783 ] Chris Male commented on LUCENE-4167: {quote} The stategy shouldn't care about the bbox concept, I agree. I think the bbox capability should be decoupled from SpatialOperation. It's not a simple matter of the client calling queryShape.getBoundingBox() since the expression of the query shape from client to server is a string. So instead of BBoxIntersects(Circle(3,5 d=10)) I propose supporting INTERSECTS(BBOX(Circle(3,5 d=10))). The actual set of operations I want to support are [E]CQL spatial predicates: http://docs.geoserver.org/latest/en/user/filter/ecql_reference.html#spatial-predicate but that perhaps deserves its own issue. {quote} I think we need to be cautious here about exposing too much complexity in the Strategys. Query language requirements shouldn't be passed on down to Strategy. Instead, the Strategys should have a very controlled list of spatial operations they support and how they are connected to the query parser should be the parser's responsibility. Requiring direct users of the Strategys to use queryShape.getBoundingBox() seems like a good way to mitigate complexity in the Strategys themselves and we can then do whatever we like in any parsers to make our query languages work. {quote} Sorry, but I disagree with your point of view. The Strategy is supposed to be a single facade to the implementation details of how a query will work, including the various possible spatial predicates (i.e. spatial operations) that is supports. If one Java class file shows that it becomes too complicated and it would be better separated because implementing different predicates are just so fundamentally different, then then the operations could be decomposed to separate source files but it would be behind the facade of the Strategy. {quote} Okay fair enough. I think we can come to a compromise. My goal here is to make it clear to the user what operations our Strategys support at compile time, not through some undocumented runtime check. That seems a recipe for disaster. Imagine someone who uses one of the Prefix Strategys and then tries to do a Disjoint operation. At runtime they get an error and then after some reading through source code they discover they actually need to use TwoDoubles which requires a re-index. Instead what I recommend is that we rename makeQuery to makeIntersectsQuery. Then all implementations of that method will only construct a Query for the intersects operation. We can then add makeXXXQuery methods to the Strategy interface as we add support to all the implementations. If a Strategy impl supports a particular operation that the rest don't, then that can just be a method on that specific Strategy and not added to the Strategy interface. Consequently TwoDoubles will get a makeDisjointQuery method. This way we have more readable code, better compile time checking and less confused users. How we map this into any Client / Server interaction or a query language should be the responsibility of those classes, not the Strategys. I'm going to create a patch to this effect. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13402827#comment-13402827 ] David Smiley commented on LUCENE-4167: -- I agree that something could/should be done to improve the awareness of exactly which operations a Strategy supports. This is of course just one aspect of a Strategy's limitations, consider wether or not the Strategy supports multi-value data or wether it supports indexing non-point shapes. Surely *that* is quite relevant to a potential client. It seems very doubtful to me that the compile-time type checks could be added for everything. And even with spatial operations -- there are a lot of them to support, and wouldn't it be twice as many for both makeXXXQuery makeXXXFilter? I don't know where you would draw the line. At least the current interface is fairly simple, and there is always Javadocs. That said, I look forward to seeing any patches you may having demonstrating what you have in mind. Maybe I just won't get it until I see it. bq. How we map this into any Client / Server interaction or a query language should be the responsibility of those classes, not the Strategies. True. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13402830#comment-13402830 ] Chris Male commented on LUCENE-4167: {quote} This is of course just one aspect of a Strategy's limitations, consider wether or not the Strategy supports multi-value data or wether it supports indexing non-point shapes. Surely that is quite relevant to a potential client. It seems very doubtful to me that the compile-time type checks could be added for everything {quote} Quite right and we can tackle these issues on a case by case basis. Having a check like supportsMultiValued() on Strategys seems like a good idea. That way the user can consult this method before indexing. {quote} And even with spatial operations – there are a lot of them to support, and wouldn't it be twice as many for both makeXXXQuery makeXXXFilter? I don't know where you would draw the line. At least the current interface is fairly simple, and there is always Javadocs. {quote} We don't have any useful Javadocs on this issue so I'm not going to rely on that. I don't see any issue with having a makeXXXQuery/Filter for each operation. Strategys are essentially factories so I think the ability to see at compile time what the factory can create is vitally important. If we get to 20 operations I'll start to worry. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13402865#comment-13402865 ] Chris Male commented on LUCENE-4167: A follow up to this patch is to break out the operation specific makeXXXQuery/Filter into their own interfaces so the concrete Strategys can declare what operations they support. We would strip SpatialStrategy back to just having createFields and then each operation specific interface (say IntersectsStrategy) would extend it. If a concrete Strategy didnt care for any of the standard operations, then it could just implement SpatialStrategy and do what it likes. However those we have currently could implement IntersectsStrategy, and TwoDoubles could implement DisjointStrategy. I'll update the patch. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13402867#comment-13402867 ] David Smiley commented on LUCENE-4167: -- I looked at the patch. {{shrug}} Some things are marginally simpler but it seems like a step back for supporting anything other than one spatial operation. Please hold off for a few days before committing without more consensus; I'd like to hear Ryan's point of view on this issue as it's a big deal. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (LUCENE-4167) Remove the use of SpatialOperation
[ https://issues.apache.org/jira/browse/LUCENE-4167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13402870#comment-13402870 ] Chris Male commented on LUCENE-4167: I don't see how it makes it harder to support more than one operation. If anything, it is making operations a 1st class citizen. Remove the use of SpatialOperation -- Key: LUCENE-4167 URL: https://issues.apache.org/jira/browse/LUCENE-4167 Project: Lucene - Java Issue Type: Bug Components: modules/spatial Reporter: Chris Male Attachments: LUCENE-4167.patch Looking at the code in TwoDoublesStrategy I noticed SpatialOperations.BBoxWithin vs isWithin which confused me. Looking over the other Strategys I see that really only isWithin and Intersects is supported. Only TwoDoublesStrategy supports IsDisjointTo. The remainder of SpatialOperations are not supported. I don't think we should use SpatialOperation as this stage since it is not clear what Operations are supported by what Strategys, many Operations are not supported, and the code for handling the Operations is usually the same. We can spin off the code for TwoDoublesStrategy's IsDisjointTo support into a different Strategy. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org