-
Notifications
You must be signed in to change notification settings - Fork 192
Description
TieredSFCIndexStrategy calculates query ranges that are always overinclusive on the edges. This behavior is good for some use cases, such as asking for data that intersects the queried data. But for other use cases, such as asking for data that contains the queried data, it searches an excessive amount of data.
For a good example of when we would want to parameterize whether we should be overinclusive on edges, consider the square between coordinates (0,0) and (1,1), with a TieredSFCIndexStrategy using the Hilbert curve. On the tier with two bits of precision, we would expect the query range from 0202 to 0202, but because the strategy is hardwired to be overinclusive on edges, we get the range from 0200 to 0203, searching the whole planet for data. At three bits of precision, we would expect the query range from 0308 to 0308, but instead we get a range that includes 0302, 0307, and 030d as well as the expected 0308.
There are at least two possible ways this could be improved. One would be to make the index strategy configurable, so its behavior is either always overinclusive, or always not overinclusive; this would involve adding a parameter to the constructor. Another would be to add overInclusiveOnEdges as a parameter of getQueryRanges, so it could be determined at query time what kind of search would be most efficient.