You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Noah Slater <ns...@apache.org> on 2013/10/24 15:16:30 UTC
Mailing list search
Hi folks,
Micro announcement: I just added a mailing list search to our website.
http://couchdb.apache.org/#mailing-lists
Next time you're stuck, you can use this. But also, next time you see
someone asking a question, and you remember that we discussed it before, or
that there is help on the mailing lists, now you can share this link with
them!
Hope this helps,
--
Noah Slater
https://twitter.com/nslater
Re: Skipping complex key values in a view function
Posted by Robert Newson <rn...@apache.org>.
"Is there a way to skip a value in a complex key (i.e. an array key)
when using startkey and end key? That is, is there a way to match any
value for an item in the array?"
Through a list function, you could, but not otherwise. A view is a
linear sequence of rows ordered by the full key, couchdb can only
efficiently look up a key or return all rows falling between two keys.
There's no such thing as a "complex" key in couchdb, it's just that
keys can be arrays and couchdb has a declared scheme for ordering of
arrays.
B.
On 26 October 2013 11:06, Andru Vallance <an...@tinymighty.com> wrote:
> Is there a way to skip a value in a complex key (i.e. an array key) when using startkey and end key? That is, is there a way to match any value for an item in the array?
>
> I have a document with a place_id, plant_id, date_created and date_modified. Sometimes I want all docs with place_id=X and plant_id=Y, where other times I only want place_id=X and any plant_id; sometimes I will want to specify a creation and/or modification date, other times this will not be relevant. Since these values are all user defined, and it's likely more properties will be added in the future, I don't think it's viable to use multiple views specific to each use case.
>
> I'm currently using a single view map emitting multiple rows with null values to allow me to specify a null value in my startkey/endkey values.
>
> function(doc){
> if(doc.type==='planting'){
> emit([doc.place_id, doc.plant_id, doc.date_created, doc.date_modified], null);
> emit([doc.place_id, null, doc.date_created, doc.date_modified], null);
> emit([null, null, doc.date_created, doc.date_modified], null);
> }
> }
>
> Is there a more elegant way I can do this without the multiple row emits?
>
> (note: I'm actually using PouchDB and replicating to CouchDB, so this map query is actually being run in the browser with PouchDB)
>
> Thanks
> Andru Vallance
Re: Skipping complex key values in a view function
Posted by Jens Alfke <je...@couchbase.com>.
On Oct 26, 2013, at 3:06 AM, Andru Vallance <an...@tinymighty.com> wrote:
> I have a document with a place_id, plant_id, date_created and date_modified. Sometimes I want all docs with place_id=X and plant_id=Y, where other times I only want place_id=X and any plant_id; sometimes I will want to specify a creation and/or modification date, other times this will not be relevant.
This should work with a single emit, unless I’m misunderstanding you. The trick is to use an empty object — {} — as a placeholder for the end of a range, since it will sort after any scalar or array value.
>From your example:
> emit([doc.place_id, doc.plant_id, doc.date_created, doc.date_modified], null);
To query for all docs with place_id=X and plant_id=Y, use
startkey = [place_id, plant_id]
endkey = [place_id, plant_id, {}]
To query for place_id=X and any plant_id, use
startkey = [place_id]
endkey = [place_id, {}]
—Jens
Skipping complex key values in a view function
Posted by Andru Vallance <an...@tinymighty.com>.
Is there a way to skip a value in a complex key (i.e. an array key) when using startkey and end key? That is, is there a way to match any value for an item in the array?
I have a document with a place_id, plant_id, date_created and date_modified. Sometimes I want all docs with place_id=X and plant_id=Y, where other times I only want place_id=X and any plant_id; sometimes I will want to specify a creation and/or modification date, other times this will not be relevant. Since these values are all user defined, and it's likely more properties will be added in the future, I don't think it's viable to use multiple views specific to each use case.
I'm currently using a single view map emitting multiple rows with null values to allow me to specify a null value in my startkey/endkey values.
function(doc){
if(doc.type==='planting'){
emit([doc.place_id, doc.plant_id, doc.date_created, doc.date_modified], null);
emit([doc.place_id, null, doc.date_created, doc.date_modified], null);
emit([null, null, doc.date_created, doc.date_modified], null);
}
}
Is there a more elegant way I can do this without the multiple row emits?
(note: I'm actually using PouchDB and replicating to CouchDB, so this map query is actually being run in the browser with PouchDB)
Thanks
Andru Vallance
Re: Mailing list search
Posted by Tim Tisdall <ti...@gmail.com>.
very helpful! thanks!
On Thu, Oct 24, 2013 at 9:16 AM, Noah Slater <ns...@apache.org> wrote:
> Hi folks,
>
> Micro announcement: I just added a mailing list search to our website.
>
> http://couchdb.apache.org/#mailing-lists
>
> Next time you're stuck, you can use this. But also, next time you see
> someone asking a question, and you remember that we discussed it before, or
> that there is help on the mailing lists, now you can share this link with
> them!
>
> Hope this helps,
>
> --
> Noah Slater
> https://twitter.com/nslater
>
Re: Mailing list search
Posted by Noah Slater <ns...@apache.org>.
On 24 October 2013 15:28, Alexander Shorin <kx...@gmail.com> wrote:
> What about http://archive.couchdb.org/ ? Great service, but mostly
> forgotten one.
>
This seems to be broken. Max, any idea?
And is it possible to use http://www.mail-archive.com/ service? It has
> much more better and friendly UI than markmail.
>
Hmm. I thought people generally preferred MarkMail?
It doesn't offer the option of searching all mailing lists at once. :(
--
Noah Slater
https://twitter.com/nslater
Re: Mailing list search
Posted by Alexander Shorin <kx...@gmail.com>.
Hi Noah,
Cool! But..no, nothing wrong, just two questions about(:
What about http://archive.couchdb.org/ ? Great service, but mostly
forgotten one.
And is it possible to use http://www.mail-archive.com/ service? It has
much more better and friendly UI than markmail.
--
,,,^..^,,,
On Thu, Oct 24, 2013 at 5:16 PM, Noah Slater <ns...@apache.org> wrote:
> Hi folks,
>
> Micro announcement: I just added a mailing list search to our website.
>
> http://couchdb.apache.org/#mailing-lists
>
> Next time you're stuck, you can use this. But also, next time you see
> someone asking a question, and you remember that we discussed it before, or
> that there is help on the mailing lists, now you can share this link with
> them!
>
> Hope this helps,
>
> --
> Noah Slater
> https://twitter.com/nslater
Re: Mailing list search
Posted by Dirkjan Ochtman <di...@ochtman.nl>.
On Thu, Oct 24, 2013 at 3:16 PM, Noah Slater <ns...@apache.org> wrote:
> Micro announcement: I just added a mailing list search to our website.
>
> http://couchdb.apache.org/#mailing-lists
Very nice, that definitely makes things easier.
AFAIK, Markmail is one of the better search engines for mailing list archives.
Cheers,
Dirkjan
Re: Mailing list search
Posted by Dirkjan Ochtman <di...@ochtman.nl>.
On Thu, Oct 24, 2013 at 3:16 PM, Noah Slater <ns...@apache.org> wrote:
> Micro announcement: I just added a mailing list search to our website.
>
> http://couchdb.apache.org/#mailing-lists
Very nice, that definitely makes things easier.
AFAIK, Markmail is one of the better search engines for mailing list archives.
Cheers,
Dirkjan