Hi Kresten,

Thanks for the response... I was thinking about this for a bit... and unless 
I'm missing something (or don't quite understand how 2i or search works), I 
don't think 2i or search will solve this problem. I may need to fall back to 
basic M/R for this.

Correct me if I'm wrong, but 2i won't work since range queries essentially 
allow you to find objects / documents where a single indexed field falls within 
a specified range. I don't believe there is a way to find objects where a 
specified value falls within a single instance of an objects 2 indexed fields 
(at least not in the way that standard 2i works). I am not sure if having the 2 
fields (startVal and endVal) be indexed is somehow more optimal for M/R than if 
the field were not indexed (could someone from Basho comment on this)?

As for search, from what I can see, it seems to be purely for text based 
searching and won't quite suite this particular use case which involves a 
somewhat range type of binary query.




________________________________
 From: Kresten Krab Thorup <k...@trifork.com>
To: Y N <yug...@yahoo.com> 
Cc: Jon Meredith <jmered...@basho.com>; "riak-users@lists.basho.com" 
<riak-users@lists.basho.com> 
Sent: Thursday, August 22, 2013 2:43 PM
Subject: Re: 2i, search or something else for most efficient "range" lookup
 

How about using a 2i range query with pagination using max_results=1?  Such 
results are ordered, so it's effectively an open ended query-for-first after N, 
if you choose a large end value for the range.

Kresten

Sent from my iPhone

On 22/08/2013, at 22.38, "Y N" <yug...@yahoo.com<mailto:yug...@yahoo.com>> 
wrote:


Hi Jon,

Thanks for your response. Unfortunately it is not as simple as that... in this 
particular case, I have a large dataset of predefined objects (with ranges 
already defined). I then need to perform the lookups given specific values.

Unfortunately the ranges are not uniform e.g. domain object 1 may be from 
1000-2000, and domain object 2 may be from 2001 to 2002 etc. The ranges do not 
overlap, but the fact that they aren't uniform makes this problem
slightly more difficult (i.e. I cannot clamp / round my value down since I 
don't have a fixed / uniform difference. In some cases the differences between 
startval and endval may be 0 or 1 or as high as 50 million).

________________________________
From: Jon Meredith <jmered...@basho.com<mailto:jmered...@basho.com>>
To: Y N <yug...@yahoo.com<mailto:yug...@yahoo.com>>
Cc: "riak-users@lists.basho.com<mailto:riak-users@lists.basho.com>" 
<riak-users@lists.basho.com<mailto:riak-users@lists.basho.com>>
Sent: Monday, August 19, 2013 5:34 AM
Subject: Re: 2i, search or something else for most efficient "range" lookup

How can you guarantee it's only a single object you'll find?

If you know an event happens every X minutes but don't know the exact 
start/stop times, you could truncate the startVal/endVal to the level of 
precision you need, hit that directly first and probe either side if you don't 
find it.

If I went with a design like that I'd make it so that I could store an array of 
readings under the key to tolerate timing issues, or to allow you to update 
your collection rate.

Jon




On Fri, Aug 16, 2013 at 6:00 PM, Y N 
<yug...@yahoo.com<mailto:yug...@yahoo.com>> wrote:
Hi,

I have a question regarding the most efficient way to perform a search / lookup 
for something. This isn't a typical range lookup (where you want to find all 
objects given a specific range). In this case I want to find
a specific object where a lookup value falls within that objects range.

My use case is as follows.... I have the following domain object:

MyObj
startVal (long / number)
endVal (long / number)
..... (other data)

I need to perform many lookups where I need to find a specific domain object 
given a long value that falls within startVal & endVal (inclusive).

What would be the most efficient way to do this in Riak? I can't think of a way 
I could do this via directly lookup, so that only leaves me with 2i and search 
as possible options.
They seem a bit like overkill, since in this case I am only interested in 
getting back a single object... but there doesn't see to be any other way to do 
this.

Would 2i or search be the most efficient / least impactful way to perform this 
type of search?

Thanks.


_______________________________________________
riak-users mailing list
riak-users@lists.basho.com<mailto:riak-users@lists.basho.com>
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com 




--
Jon Meredith
VP, Engineering
Basho Technologies, Inc.
jmered...@basho.com<mailto:jmered...@basho.com>


_______________________________________________
riak-users mailing list
riak-users@lists.basho.com<mailto:riak-users@lists.basho.com>
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com 
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to