couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Barnes <mrtr...@gmail.com>
Subject Re: Recommendations for how to do faceted search in CouchDB
Date Fri, 01 Apr 2011 00:09:52 GMT
For searching for an arbitrary set of conditions on fields, you will 
want to use a search component like couchdb-lucene.

It's not just useful for full-text search; if you have a bunch of 
parameters that you want to filter on, your lucene view can look like:

function(doc) {
	var ret = new Document();
	if (foo in doc) ret.add(doc.foo,{"field":"foo","index":"not_analysed");
	if (bar in doc) ret.add(doc.bar,{"field":"bar","index":"not_analysed");
	...etc

	return ret;
}

Then your query can look like q="foo:5 OR bar:Sydney".
Full-text search indices can live alongside not_analysed indexes too, so 
you can use for each whatever makes sense.

-Patrick

On 1/04/2011 4:30 AM, Clement Hallet wrote:
> Hi,
>
> I'm interested in that question too but a bit noob with CouchDB.
>
> The goal of faceted search is to put conditions on several fields at a time, and get
the union of that set of conditions, right ?
> then how would you do that in the query ?
>

Mime
View raw message