On 3/28/07, Chris Muller <asqueaker@gmail.com> wrote:
Consider we're looking with 'foo t? b?rt':

(thinking out loud here)

  - scan through the "like" string, get all the pieces between
wildcards:  #('foo t' ' b' 'rt')

  - for all but the right-most, use the standard wildcard range:

       & (familyName between: 'foo t' and: 'foo t' alphabeticalNext)

  - but for the right-most one, use equals:

      & (familyName equals: 'rt')

Sigh..  This obviously isn't water tight..  It doesn't account for the
*order* in which the elements appear, only that they all appear
somewhere.  Still, that index-type #3 really offers a lot of bang for
the buck.  I'm sure we will indeed end up needing more than one
underlying index-type, I'm just not sure what..   and I have no
problem double-dispatching to the index, back to the collection to add
itself (themselves).
 
Actually, if you used that scheme to get the candidates that could be valid, and then ran one last check using the equivalent of #match: (beefed up for single character wildcards - need to write that) on the candidates, that would be water tight.  That is, pick up the possible candidates, get the actual value form the object, and see if that attirbute of the object actually matches the pattern as passed in.  This way you get most of the benefit of the index AND you can make sure it is right.
 
At least, that should work.  I haven't delved into the innards of Magma to even know if that is possible.
 
-ChrisC