couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jaap van der Plas" <j...@brightin.nl>
Subject Re: Multiple filters on a large data set
Date Fri, 26 Sep 2008 18:05:29 GMT
Yep, this would work fine for when you want to do a search based on
one field, but for more than one you'd have to do multiple queries and
retrieve the intersections between the results in your application
code. This feels to me like something a database should take care of,
and might become problematic when you have your webpage code talk with
couchdb directly.

Another way would be a map function that would key/value pair next to
every other key/value pair and create a huge map, but I'm slightly
worried it would grow a bit too large...

On Fri, Sep 26, 2008 at 18:40, Chris Anderson <jchris@apache.org> wrote:
> On Fri, Sep 26, 2008 at 4:54 AM, Jaap van der Plas <jaap@brightin.nl> wrote:
>> Greetings Jan,
>>
>> the goal is not so much to allow full-text search on the documents
>> fields, as to be able to retrieve records based any set of field names
>> with specific values (or perhaps ranges.) Basically, what the 'where'
>> clause can do in SQL.
>
> You could do a view like:
>
> function(doc) {
>  var f;
>  for (f in doc) {
>    emit([f, doc[f]], null);
>  }
> }
>
> This would emit a key based on the name and value of every field in a
> document. You might do well to optimize it by avoiding the fields that
> start with "_" or other fields you don't care to index. You'll use a
> lot of disc this way, but assuming you know at query time which field
> you are interested in, it should be very fast to lookup keys and key
> ranges within a given field.
>
>
> --
> Chris Anderson
> http://jchris.mfdz.com
>

Mime
View raw message