couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Samuel Newson <rnew...@apache.org>
Subject Re: couchdb-lucene: search attachment only if document criteria met
Date Mon, 07 Apr 2014 19:53:54 GMT

add ret.add(doc.foo, {"field":"foo"}); to your index function and do

?q=foo:zooph+AND+hello

B.


On 7 Apr 2014, at 19:59, Hank Knight <hknight555@gmail.com> wrote:

> I use this to find all documents where foo == zooph
> 
> function(doc) {
> if(doc.foo=='zooph') {
>  emit(null, doc);
> }
> }
> 
> I use this (powered by couchdb-lucene) to find all documents with
> attachments containing "hello":
> 
> {
>   "_id": "_design/find",
>   "fulltext": {
>       "html": {
>           "index": "function(doc) {var result = new
> Document();for(var a in doc._attachments)
> {result.attachment('default', a);}return result;}"
>       }
>   }
> }
> http://example.com/_fti/local/resources/_design/find/html?q=hello
> 
> How can these be combined?  I only want results that contain "hello"
> where foo equals zooph.


Mime
View raw message