User Tools

Site Tools


Sidebar

indexes:multipart_ge

Q. In a multipart index, how can I check for EQ in the first part and GT in the second part? (2016)

A. Use the GE iterator and specify a partial key. It will position the iterator on the first key that is greater than or equal to the key specified. Break the loop when the first part of the tuple becomes different from the search key (key part).

You could use this simple example as the basis:

for tuple in
box.space.t.index.primary:pairs("XY",{iterator = "GE"}) do
  if (string.sub(tuple[1], 1, 2) ~= "XY") then break end
  print(tuple)
end

But don't use string.sub, just compare tuple[1] and the search key.

Comments

Enter your comment. Wiki syntax is allowed:
E S S P A
 
indexes/multipart_ge.txt · Last modified: 2018/06/04 16:53 by eabates

Real Time Web Analytics