couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Metson <simonmet...@googlemail.com>
Subject Re: Search data in CouchDb!
Date Mon, 20 Feb 2012 12:33:41 GMT
Hi,  
You need to write a view with the module of the doc as the key. E.g.

function(doc){
  if(doc.module){
    emit(doc.module, doc.title);
  }
}

then query it with ?key=articles. See also http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views

Cheers
Simon


On Monday, 20 February 2012 at 03:56, itthuyloi wrote:

> I'm using ElasticSearch (PHP Elastica) to integarate CouchDb.
> Ex:
> Doc 1: {"_id": "ART_dssdfsdf", "module": "articles", "title": "Tieng Lang
> Viet Nam ....."}
> Doc 2: {"_id": "USE_dss4dfsdf", "module": "user", "fullname": "Nguyen Van
> A"}
> Doc 3: {"_id": "ART_dssdf3sdf", "module": "articles", "title": "Tieng Lang
> Viet Nam 3....."}
> .......
> There are so many documents which is distinguished by "module".
> Now, I want to map its together by term, ex: type: articles will be listing
> all doc with module=articles.....
> But I don't know how to do it! Please help me! Thanks!
> I try to search hard, and found: http://ruflin.github.com/Elastica/
> Therefore, I search in all document. :(
> 
> --
> View this message in context: http://couchdb-development.1959287.n2.nabble.com/Search-data-in-CouchDb-tp7300195p7300195.html
> Sent from the CouchDB Development mailing list archive at Nabble.com (http://Nabble.com).
> 
> 



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message