Is there any way to have multiple tag search implemented in CouchDB? I have documents (posts) each with multiple tags. I need to find posts that have been tagged with an arbitrary set of tags. How do I do it? I could of course do it with multiple calls to a view which gives me the documents for a tag and then sort it out in my app but I wanted to know if there was a way to achieve the same in the CouchDB view land.
In the more recent versions of CouchDB, you can POST to a view with a JSON document called keys
, which allows for multi-key lookup. The structure would look something like this:
{"keys": ["first_tag", "second_tag", "third_tag"]}
This could be POSTed to a view that you have that is emitting tags for its respective keys.
This and other querying options are documented here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With