incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Lehnardt <...@apache.org>
Subject Re: Views using JSON Arrays
Date Thu, 03 Jul 2008 18:17:22 GMT

On Jul 3, 2008, at 20:07, Paul Bonser wrote:

> On Thu, Jul 3, 2008 at 8:01 AM, Bradford Winfrey <bradswinfrey@yahoo.com 
> > wrote:
>
>> We would get back each one of our tags as a key, yea?  Only if we  
>> supplied one at a time.  So how does one go about supplying a  
>> range, array (not sure what we'd call it here) of keys to be  
>> searched on?  http://...?key=["octopus","hockey"] maybe?  I'm  
>> unsure of the plan of attack for such a thing.  Maybe I'm just  
>> going about it in the wrong direction.  Any thoughts?
>
> Hey everyone. I've pretty much just been watching the mailing list  
> here myself.
>
> This is the second time somebody has asked about this since I've
> started watching this mailing list. I could see it being a valuable
> feature.
>
> Would it be valuable to add the ability to query a view with multiple
> keys, getting the results for each of those keys back? Something like
> http://...?key_list=["octopus","hockey"]
>
> If I were interested in investigating how hard it would be to add that
> feature, where would I start looking in the code?

This simply doesn't fit the way views work. They are single indexes  
that you
can use for single-key or or key-range lookups. if you need random  
access
you'd basically need to query the view as many times as you have keys
to search. No matter if you do that in front or behind the API.

Things to work around that:

1) In the client, compute the 'smallest' and 'largest' key and make a  
range
lookup and simply throw away in the client what you are not interested  
in.
You might get a lot of data with this, but maybe not, depends on your  
data.

2) Do single lookups. One per key. Map-index lookups are nearly instant,
so running 3 or 4 is not a big deal. That might not work well for lots  
of
keys.

3) Leverage fulltext search. The best generic solution for this is  
probably
a fulltext index like Lucene or Sphinx could give you.

4) There might be other ways that people smarter than I am can  
envision :)

Cheers
Jan
--

Mime
View raw message