I need to normalize relative ordering of the contents of an array into something that can be efficiently indexed and queried against.
Given data: [".content", "blah", "woo"] that should be discovered by a query ".content" FOLLOWED_BY "woo"
Note the sparseness. It's contingent on the relative ordering of the elements, not the absolute values of the indexes.
I'm trying to figure out if there's a way to represent the relative ordering as neatly indexable, absolute values.
To index these relative positions I would have to index an explosion of paired off values. [".content", "blah", "woo"] would return into (".content", "blah", OBJ_ID), (".content", "woo", OBJ_ID), ("blah", "woo", OBJ_ID).
I need roughly (log n) access into a continually accumulated index of this data.
Can I normalize the relative ordering into an absolute space such that queries can be answered by a range query?