couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Crowell <robccrow...@gmail.com>
Subject Building views to locate documents WITHOUT a certain set of tags
Date Wed, 30 Nov 2011 20:10:52 GMT
Hey everyone, view question here.

I've got couch records that represent images.  They may have any
number of tags (from zero to hundreds).  However, while there are
thousands of tags in the dataset, there are only a couple that are
considered "bad" (BROKEN_IMAGE, BLANK_IMAGE, etc.)  Here's an example
document:

{
    _id: ...,
    url: "http://example.org/whatever.png",
    tags: ["OUTDOORS", "BEACH", "RED_DRESS"]
}

I wrote a view to emit documents that don't have these "bad" tags by
hard-coding the list of bad tags and checking every tag against this
list.  If none of the tags are bad, then emit the document.

However, a user may also specify tags that he doesn't like
(OFFENSIVE_IMAGE, DENVER_BRONCOS, whatever).  Is there any good way to
build a view around this idea ("show me all documents that don't have
a set of tags") short of defining a custom view (with their own "bad"
tags list) for every user?

I could do this filtering client-side of course, but if I wanted to
generate an exhaustive list of matching documents (for a report or
something similar) then it would be a lot of work.  I'm stumped at the
moment.  Thanks for any suggestions!

Mime
View raw message