User Tools

Site Tools



Q. How can I do value like 'pattern%s' with a TREE index? (2016)

A. Specify a partial key for the GE iterator:

for k, v in 
space:pairs('pattern', {iterator = 'GE'}) do if it_is_not_like(v) 
break <do stuff with v> end

You can also do it with pairs():

for tuple in"XY",{iterator = "GE"}) do
  if (string.sub(tuple[1], 1, 2) ~= "XY") then break end

This Lua code finds all the tuples whose primary key values begin with ‘XY’. One of the assumptions is that there is a one-part primary-key TREE index on the first field, which must be a string. The iterator loop ensures that the search returns tuples where the first value is greater than or equal to ‘XY’. The conditional statement within the loop ensures that the looping stops when the first two letters are not ‘XY’.


Enter your comment. Wiki syntax is allowed:
indexes/tree_patterns.txt · Last modified: 2018/06/04 16:54 by eabates

Real Time Web Analytics