You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Pulkit Singhal <pu...@gmail.com> on 2012/09/18 06:45:04 UTC

Wildcard search on startkey and endkey

With a compound key being spit out by a MAP as follows:
emit ( [elem1, elem2, elem3, elem4, elem5], doc);

Is it possible to do a search using startkey and endkey in v1.2.0 where the
beginning elements could be anything? Like this:
startkey=[ {}, {}, {}, "elem4name", "elem5name" ]

Thoughts?

Re: Wildcard search on startkey and endkey

Posted by Keith Gable <zi...@ignition-project.com>.
CouchDB is a lot easier to understand if you think about querying views
alphabetically like a card catalog. You can say "AA to BZ" but you cannot
say "*A to *Z".

That said, CouchDB Lucene is actually built for those kinds of queries (and
more) and it is really simple to use. Try it out.
On Sep 17, 2012 11:52 PM, "Pulkit Singhal" <pu...@gmail.com> wrote:

> With a compound key being spit out by a MAP as follows:
> emit ( [elem1, elem2, elem3, elem4, elem5], doc);
>
> Is it possible to do a search using startkey and endkey in v1.2.0 where the
> beginning elements could be anything? Like this:
> startkey=[ {}, {}, {}, "elem4name", "elem5name" ]
>
> Thoughts?
>

Re: Wildcard search on startkey and endkey

Posted by Mark Hahn <ma...@hahnca.com>.
The key and id are always included.

On Wed, Sep 19, 2012 at 12:45 AM, Pulkit Singhal <pu...@gmail.com>wrote:

> Hello Aurélien!
>
>
> You can "emit([elem1, elem2, elem3, elem4, elem5], null)"
> > and then get the view with "include_docs=true".
> > You'll get a smaller index on disk and I suppose you will need less
> memory
> > and CPU to handle it.
> >
>
> I thought it needed to at least emit the _id like so:
> emit([elem1, elem2, elem3, elem4, elem5], {"_id":doc._id})
>
> Or am I confusing the download of associative documents here?
>

Re: Wildcard search on startkey and endkey

Posted by Pulkit Singhal <pu...@gmail.com>.
Hello Aurélien!


You can "emit([elem1, elem2, elem3, elem4, elem5], null)"
> and then get the view with "include_docs=true".
> You'll get a smaller index on disk and I suppose you will need less memory
> and CPU to handle it.
>

I thought it needed to at least emit the _id like so:
emit([elem1, elem2, elem3, elem4, elem5], {"_id":doc._id})

Or am I confusing the download of associative documents here?

Re: Wildcard search on startkey and endkey

Posted by Aurélien Bénel <au...@utt.fr>.
Hi Pulkit,

> Is it possible to do a search using startkey and endkey in v1.2.0 where the
> beginning elements could be anything? Like this:
> startkey=[ {}, {}, {}, "elem4name", "elem5name" ]

No. Think about the view index as a set of cards in a card sorter. You need to know where to start searching.
If you need to search a card according to elem4name and elem5name, build a view for that.

> With a compound key being spit out by a MAP as follows:
> emit ( [elem1, elem2, elem3, elem4, elem5], doc);

Please note that you never need to emit the document.
You can "emit([elem1, elem2, elem3, elem4, elem5], null)"
and then get the view with "include_docs=true".
You'll get a smaller index on disk and I suppose you will need less memory and CPU to handle it.


Regards,

Aurélien