Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Complex dynamic queries in CouchDB

Tags:

couchdb

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 tag 'couchdb' and is_published=true" or "date is within last month and the author is me".

How do such queries work in CouchDB?

like image 439
artemb Avatar asked Jul 19 '10 10:07

artemb


2 Answers

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.

like image 78
andyuk Avatar answered Oct 02 '22 03:10

andyuk


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.

like image 35
Sam Bisbee Avatar answered Oct 02 '22 05:10

Sam Bisbee