incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From svilen ...@svilendobrev.com>
Subject Re: request with OR conditions
Date Sat, 08 Dec 2012 20:30:06 GMT
{keys: list-of-keys} is an OR, not AND - {keys : [1,2]} means give 
items with key=1 OR key=2 
(human language is not math - "give me the apple and the orange" is not
same as "give me the thing that is apple and is orange".

so if u normalize your query into OR ( ANDs ), and build n-dimensional
array-key [tag1,tag2,tag3,tag4,...tagn], u could do it - in
theory...  it's not dynamic - so n is constant. and u cant filter on
tag2 without tag1.. sub-keys can only be like key1..keym where m<=n

the only other/real way is do n queries for your current OR parts,
then intersect (AND) in memory. try, it may be faster than the
sql-joins.

ciao
svilen

On Sat, 8 Dec 2012 13:17:38 +0400
Aleksey Kluchnikov <alexs@ximad.com> wrote:

> * Keith Gable <ziggy@ignition-project.com> [2012-12-07 18:42:30
> -0600]:
> 
> AND part as discribed in 
> http://wiki.apache.org/couchdb/HTTP_view_API
> via keys array or via json in POST
> {"keys": ["key1", "key2", ...]}.
> 
> Question is how to do OR part?
> 
> > I would be curious how you're doing the "AND" part. If you're
> > querying the view with multiple keys, you could look into keys that
> > are arrays and see if that works for you.
> > On Dec 7, 2012 12:39 AM, "Aleksey Kluchnikov" <alexs@ximad.com>
> > wrote:
> > 
> > >
> > > Hi all.
> > >
> > > I need choose database for new project.
> > > CouchDB is works for me.
> > >
> > > But i need a functionality of OR in search requests.
> > >
> > > Like in sql:
> > > where
> > > (tag1 = val1 OR tag1 = default) AND
> > > (tag2 = val2 OR tag2 = default) AND
> > > (tag3 = val3 OR tag3 = default) AND
> > > (tag4 = val4 OR tag4 = default) ...
> > >
> > >
> > > Is it possible with CouchDB?
> > >
> > >
> > > --
> > > Aleksey Kluchnikov
> > >
> 
> -- 
> Aleksey Kluchnikov,
> XiMAD server side engineer (Ulyanovsk)
> Email/Jabber: alexey.kluchnikov<at>ximad.com
> Skype: kluchnikov<dot>aleksey

Mime
View raw message