You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by mi...@free.fr on 2011/02/17 10:10:05 UTC

the feature of my dream

Hello devs,

I hope this thread will bring some interesting ideas. Using Couch for a few years now, there is one feature I think would add great powerb. Note that any new function name/query option name I use is only to explain my point.

So let's say I have a design doc "foo" with a "bar" map function being :

function(doc) {
	emitIndexedObject({color: "blue", shape: "circle", active: true},null);
	emitIndexedObject({color: "blue", shape: "circle", active: false},null);
	emitIndexedObject({color: "red", shape: "circle", active: false},null);
}

(of course static values in this example would certainly, in real life, be issued from the "doc")

Then I can query this view like :

/_design/foo/_view/bar?indexes={active:true}
=>
{
total_rows: ...,
offset: ...,
rows:
[
	{
		id: ...,
		key: {color: "blue", shape: "circle", active: true},
		value: ...
	}
]
}

/_design/foo/_view/bar?indexes={color:"blue"}
=>
{
total_rows: ...,
offset: ...,
rows:
[
	{
		id: ...,
		key: {color: "blue", shape: "circle", active: true},
		value: ...
	},
	{
		id: ...,
		key: {color: "blue", shape: "circle", active: false},
		value: ...
	}
]
}

/_design/foo/_view/bar?indexes={color:"blue",active:false}
=>
{
total_rows: ...,
offset: ...,
rows:
[
	{
		id: ...,
		key: {color: "blue", shape: "circle", active: false},
		value: ...
	}
]
}

Hope you get the idea.

What are your thoughts on this ?

Regards,

Mickael

Re: the feature of my dream

Posted by Benoit Chesneau <bc...@gmail.com>.
On Sat, Feb 19, 2011 at 4:32 PM, Anand Chitipothu <an...@gmail.com> wrote:
> 2011/2/17  <mi...@free.fr>:
>>
>> Hello devs,
>>
>> I hope this thread will bring some interesting ideas. Using Couch for a few years now, there is one feature I think would add great powerb. Note that any new function name/query option name I use is only to explain my point.
>>
>> So let's say I have a design doc "foo" with a "bar" map function being :
>>
>> function(doc) {
>>        emitIndexedObject({color: "blue", shape: "circle", active: true},null);
>>        emitIndexedObject({color: "blue", shape: "circle", active: false},null);
>>        emitIndexedObject({color: "red", shape: "circle", active: false},null);
>> }
>>
>> (of course static values in this example would certainly, in real life, be issued from the "doc")
>>
>> Then I can query this view like :
>>
>> /_design/foo/_view/bar?indexes={active:true}
>> =>
>> {
>> total_rows: ...,
>> offset: ...,
>> rows:
>> [
>>        {
>>                id: ...,
>>                key: {color: "blue", shape: "circle", active: true},
>>                value: ...
>>        }
>> ]
>> }
>>
>> /_design/foo/_view/bar?indexes={color:"blue"}
>> =>
>> {
>> total_rows: ...,
>> offset: ...,
>> rows:
>> [
>>        {
>>                id: ...,
>>                key: {color: "blue", shape: "circle", active: true},
>>                value: ...
>>        },
>>        {
>>                id: ...,
>>                key: {color: "blue", shape: "circle", active: false},
>>                value: ...
>>        }
>> ]
>> }
>>
>> /_design/foo/_view/bar?indexes={color:"blue",active:false}
>> =>
>> {
>> total_rows: ...,
>> offset: ...,
>> rows:
>> [
>>        {
>>                id: ...,
>>                key: {color: "blue", shape: "circle", active: false},
>>                value: ...
>>        }
>> ]
>> }
>>
>> Hope you get the idea.
>>
>> What are your thoughts on this ?
>
> Use couchdb-lucene.
>
> https://github.com/rnewson/couchdb-lucene/
>
> Anand
>

Or elasticsearch :

http://www.elasticsearch.org/guide/reference/river/couchdb.html

- benoît

Re: the feature of my dream

Posted by Anand Chitipothu <an...@gmail.com>.
2011/2/17  <mi...@free.fr>:
>
> Hello devs,
>
> I hope this thread will bring some interesting ideas. Using Couch for a few years now, there is one feature I think would add great powerb. Note that any new function name/query option name I use is only to explain my point.
>
> So let's say I have a design doc "foo" with a "bar" map function being :
>
> function(doc) {
>        emitIndexedObject({color: "blue", shape: "circle", active: true},null);
>        emitIndexedObject({color: "blue", shape: "circle", active: false},null);
>        emitIndexedObject({color: "red", shape: "circle", active: false},null);
> }
>
> (of course static values in this example would certainly, in real life, be issued from the "doc")
>
> Then I can query this view like :
>
> /_design/foo/_view/bar?indexes={active:true}
> =>
> {
> total_rows: ...,
> offset: ...,
> rows:
> [
>        {
>                id: ...,
>                key: {color: "blue", shape: "circle", active: true},
>                value: ...
>        }
> ]
> }
>
> /_design/foo/_view/bar?indexes={color:"blue"}
> =>
> {
> total_rows: ...,
> offset: ...,
> rows:
> [
>        {
>                id: ...,
>                key: {color: "blue", shape: "circle", active: true},
>                value: ...
>        },
>        {
>                id: ...,
>                key: {color: "blue", shape: "circle", active: false},
>                value: ...
>        }
> ]
> }
>
> /_design/foo/_view/bar?indexes={color:"blue",active:false}
> =>
> {
> total_rows: ...,
> offset: ...,
> rows:
> [
>        {
>                id: ...,
>                key: {color: "blue", shape: "circle", active: false},
>                value: ...
>        }
> ]
> }
>
> Hope you get the idea.
>
> What are your thoughts on this ?

Use couchdb-lucene.

https://github.com/rnewson/couchdb-lucene/

Anand