I am starting with CouchDB and need a little help.
I have a whole lot of data which is listed to the user in a table. The user should be able to filter that data by multiple dynamic parameters.
E.g. assume a table with fields date, author, tags, is_published, title.
The user should be able to specify any filter like "Contains ta开发者_Python百科g 'couchdb' and is_published=true" or "date is within last month and the author is me".
How do such queries work in CouchDB?
I think the standard answer for complex queries is to use Lucene. Perhaps not the answer you were looking for, but Lucene has more advanced filtering capabilities.
Take a look at couchdb-lucene on github. There is also another page on the couchDB wiki about full text indexing.
The out-of-the-box solution is that you create those queries for them before hand in your design document(s). If you feel, correctly or incorrectly, that this is going to limit your users, then follow andyuk's suggestion and look at couchdb-lucene.
Though I'd be suspicious if you couldn't do what you're looking for in a few map/reduce queries. Remember, you can emit() more than once in a map function.
精彩评论