You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Davide Giannella <gi...@gmail.com> on 2014/03/13 15:49:35 UTC

OAK-1263 and range queries

Good afternoon team,

trying to implement the range queries (>, >=, <, <=) as part of the
Ordered Index. I encountered a problem that I think is not easily (or
possible) to solve without a change in the API.

The flow when performing a query is the following:

1) a QueryIndex is asked for a cost: QueryIndex.getCost()
2) If it's the lower one it will be asked to query: QueryIndex.query()
3) After some checks it basically delegates to a
PropertyIndexLookup.query().

At this stage the query() method for the IndexLookup accept only a list
of values while the concept of ranges is expressed in the
Filter.PropertyRestriction with something like !first.equals(last)

http://goo.gl/c8qGs1.

I therefore need to pass down to the lookup the full PropertyRestriction
object for later evaluation

http://goo.gl/uPCEST

4) The lookup after some checks pass down to the
IndexStoreStrategy.query() that is the one eventually able to actually
perform the filter. This again accept only a list of values while I need
the full PropertyRestriction. http://goo.gl/Bt7Pfo

Therefore in order to achieve the Range query I had to pass down the
PropertyRestriction up to the IndexStoreStrategy. Currently I didn't
change the API but worked through casting in specialised cases.

Was wondering if I'm missing anything, anyone else has better ideas or
we should actually change the API along the chain.

Here's my initial (incomplete) implementation step-by-step if you wish
to follow it.

1) http://goo.gl/2S1NNP
2) http://goo.gl/NvFWyC
3) http://goo.gl/NvFWyC
4) http://goo.gl/8xPxNh

Thanks for any hints
Davide