barch

Fast Ranged Queries and Aggregates

B.ARCH is adept at providing fast (O(k)) ranged queries based on the underlying order of keys.

Lets consider a simple example to illustrate:

First add some data:

B.SET bicycle:mountain 1
B.SET bicycle:racing 1
B.SET bicycle:tricycle 1

B.SET car:manufacturer:bmw 1
B.SET car:manufacturer:honda 1
B.SET car:manufacturer:toyota 1

B.SET cat:callycoe 1
B.SET cat:persion 1
B.SET cat:torty 1

B.SET eyes:blue 1
B.SET eyes:brown 1
B.SET eyes:green 1

We can now determine which car manufacturers there are:

B.COUNT car:manufacturer: car:~

returns

(integer) 3

And

 B.RANGE car:manufacturer:b car:manufacturer:~ 1000

Returns

1) "car:manufacturer:bmw"
2) "car:manufacturer:honda"
3) "car:manufacturer:toyota"

While

B.RANGE bicycle: bicycle:~ 1000

Returns

1) "bicycle:mountain"
2) "bicycle:racing"
3) "bicycle:tricycle"

Another example

B.RANGE eyes: eyes:~ 1000

produces

1) "eyes:blue"
2) "eyes:brown"
3) "eyes:green"

Just for funzies

B.RANGE car: ca~ 1000 
1) "car:manufacturer:bmw"
2) "car:manufacturer:honda"
3) "car:manufacturer:toyota"
4) "cat:callycoe"
5) "cat:persion"
6) "cat:torty"