couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Newson <rnew...@apache.org>
Subject Re: (Dynamically) excluding documents from a view query
Date Tue, 16 Oct 2012 13:29:45 GMT
I can't speak about ElasticSearch, but the CouchDB-Lucene query would
certainly reflect the current state of your database (i.e, no "delay")
when you query.

As for the original question, I don't think you can achieve it
directly with CouchDB views. If you emit each tag of a document as a
key, and null for value (e.g, emit("a",null)), then you could make two
concurrent queries for ?key=a and ?key=b, and read each, row by row,
filtering out as appropriate. It's not trivial.

B.

On 16 October 2012 05:50, boazc <bcitrin@gmail.com> wrote:
> Hello,
>
> My documents contain tags which have a corresponding view.
> I want to retrieve all documents that contain a certain tag, but don't
> contain another one.
> (Note that I don't know about the possible tags in advance).
>
> Example:
> id: doc1, tags: [a, b]
> id: doc2, tags: [b, c]
> id: doc3, tags: [a, c]
> If I want all docs with tag=a but not tag=b I expect to get only doc3.
>
> Is there a way to achieve this on CouchDB side?
> Needless to say I cannot do it on the client side as I cannot benefit from
> pagination and anyway might receive an extreme set of documents I need to
> work on.
>
> I know I can turn to some search engines e.g. ElasticSearch or
> CouchDB-Lucene, but other than introducing a new component to the system it
> also means an inherent delay between the "real" data and the indexed data
> which in my domain is unacceptable.
>
> Thanks!!
>
>
>
> --
> View this message in context: http://couchdb-development.1959287.n2.nabble.com/Dynamically-excluding-documents-from-a-view-query-tp7581297.html
> Sent from the CouchDB Development mailing list archive at Nabble.com.

Mime
View raw message