Hi Adam,
I'm working on exactly such a feature. It'll loop through a view
result-set and query an external script if a document should make it
into the final output or not.
I hope to get some code out this weekend, but it'll be alpha quality and
definitely not ready for general consumption.
Cheers,
Volker
Adam Groves wrote:
> Hi,
>
> I've just started taking a look into the external capabilities of
> couchdb, with the hope that it may provide a solution for what I want
> to achieve.
>
> I have a view which is used for every account to render documents only
> belonging to that account. The max no. of documents per account is
> 1000. Each document has a title and a description and I'd like for the
> account holder to be able to search these two fields.
>
> My view is along these lines:
>
> function(doc) {
> text = (doc.title + " " + doc.description).toLowerCase();
> emit([doc.project_id, text], null);
> }
>
> So _view/Document/all gives me the following result:
>
> {"total_rows":1000,"offset":0,"rows":[
> {'id': 12345, 'key':[12345, 'title text plus description'], 'value':
> null},
> { ... },
> { ... }
> ]
> }
>
>
> Is there any way to pass on this view result to an external script
> where it can be parsed for the query string and returned and then have
> the view parameters (startkey endkey limit etc) applied?
>
> I am aware of couchdb-lucene and have tried it out. It's a brilliant
> project but is a bit of an overkill for my specific requirement.
>
> Many thanks in advance
>
> Adam Groves
>
> PS: Where can I find some nice external code examples? The only ones
> I'm aware of to date are the python example on the wiki, the java
> examples in the various couch lucene/solr projects and a ruby example
> in CouchObject.