You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Jürgen Jakobitsch SWC <j....@semantic-web.at> on 2013/05/20 09:18:45 UTC

custom index

hi,

i'm totally new to couchdb and need to find out if couchdb is usable
in my project.
i need to be able to create a custom index (btree) on
what was once a table column. 
i saw that there's an geo spatial extension which was always a sign of
custom indizes.
i need to create a special btree (a regex btree) for a certain key in a
json document that does some magic.

is something like that doable in couchdb? (holding thumbs)

any pointer really appreciated.

wkr j

-- 
| Jürgen Jakobitsch, 
| Software Developer
| Semantic Web Company GmbH
| Mariahilfer Straße 70 / Neubaugasse 1, Top 8
| A - 1070 Wien, Austria
| Mob +43 676 62 12 710 | Fax +43.1.402 12 35 - 22

COMPANY INFORMATION
| web       : http://www.semantic-web.at/
| foaf      : http://company.semantic-web.at/person/juergen_jakobitsch
PERSONAL INFORMATION
| web       : http://www.turnguard.com
| foaf      : http://www.turnguard.com/turnguard
| g+        : https://plus.google.com/111233759991616358206/posts
| skype     : jakobitsch-punkt
| xmlns:tg  = "http://www.turnguard.com/turnguard#"


Re: custom index

Posted by Jonas Weber <ma...@jonasw.de>.
Hi Jürgen,

this is definitely possible, the feature you are looking for is called 
"Views". These functions are called once, when a document is stored 
(update/create), and you can emit anything you want from it. The key you 
emit is stored for fast access.

see http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views


On 2013-05-20 09:18, Jürgen Jakobitsch SWC wrote:
> hi,
>
> i'm totally new to couchdb and need to find out if couchdb is usable
> in my project.
> i need to be able to create a custom index (btree) on
> what was once a table column.
> i saw that there's an geo spatial extension which was always a sign 
> of
> custom indizes.
> i need to create a special btree (a regex btree) for a certain key in 
> a
> json document that does some magic.
>
> is something like that doable in couchdb? (holding thumbs)
>
> any pointer really appreciated.
>
> wkr j
>
> --
> | Jürgen Jakobitsch,
> | Software Developer
> | Semantic Web Company GmbH
> | Mariahilfer Straße 70 / Neubaugasse 1, Top 8
> | A - 1070 Wien, Austria
> | Mob +43 676 62 12 710 | Fax +43.1.402 12 35 - 22
>
> COMPANY INFORMATION
> | web       : http://www.semantic-web.at/
> | foaf      : 
> http://company.semantic-web.at/person/juergen_jakobitsch
> PERSONAL INFORMATION
> | web       : http://www.turnguard.com
> | foaf      : http://www.turnguard.com/turnguard
> | g+        : https://plus.google.com/111233759991616358206/posts
> | skype     : jakobitsch-punkt
> | xmlns:tg  = "http://www.turnguard.com/turnguard#"

Re: custom index

Posted by Jürgen Jakobitsch SWC <j....@semantic-web.at>.
thank y'all for input, pointers and warm welcome!

i'll put "the community" on my internal couchDB feature list!

wkr j

On Mon, 2013-05-20 at 09:18 +0200, Jürgen Jakobitsch SWC wrote:
> hi,
> 
> i'm totally new to couchdb and need to find out if couchdb is usable
> in my project.
> i need to be able to create a custom index (btree) on
> what was once a table column. 
> i saw that there's an geo spatial extension which was always a sign of
> custom indizes.
> i need to create a special btree (a regex btree) for a certain key in a
> json document that does some magic.
> 
> is something like that doable in couchdb? (holding thumbs)
> 
> any pointer really appreciated.
> 
> wkr j
> 

-- 
| Jürgen Jakobitsch, 
| Software Developer
| Semantic Web Company GmbH
| Mariahilfer Straße 70 / Neubaugasse 1, Top 8
| A - 1070 Wien, Austria
| Mob +43 676 62 12 710 | Fax +43.1.402 12 35 - 22

COMPANY INFORMATION
| web       : http://www.semantic-web.at/
| foaf      : http://company.semantic-web.at/person/juergen_jakobitsch
PERSONAL INFORMATION
| web       : http://www.turnguard.com
| foaf      : http://www.turnguard.com/turnguard
| g+        : https://plus.google.com/111233759991616358206/posts
| skype     : jakobitsch-punkt
| xmlns:tg  = "http://www.turnguard.com/turnguard#"


Re: custom index

Posted by Volker Mische <vo...@gmail.com>.
On 05/20/2013 09:18 AM, Jürgen Jakobitsch SWC wrote:
> hi,
> 
> i'm totally new to couchdb and need to find out if couchdb is usable
> in my project.
> i need to be able to create a custom index (btree) on
> what was once a table column. 
> i saw that there's an geo spatial extension which was always a sign of
> custom indizes.
> i need to create a special btree (a regex btree) for a certain key in a
> json document that does some magic.
> 
> is something like that doable in couchdb? (holding thumbs)
> 
> any pointer really appreciated.
> 
> wkr j

Hi Jürgen,

custom indexers like GeoCouch are not super easy to do, but possible.
I've written a tutorial about it a long time ago (must be 3 years or so)
[1]. The basic idea should still be the same, the details might be
different.

[1] http://vmx.cx/couchdb/tutorial/indexer.html

Cheers,
  Volker

Re: custom index

Posted by Jens Alfke <je...@couchbase.com>.
On May 20, 2013, at 12:18 AM, Jürgen Jakobitsch SWC <j....@semantic-web.at> wrote:

> i need to be able to create a custom index (btree) on
> what was once a table column. 
> i saw that there's an geo spatial extension which was always a sign of
> custom indizes.
> i need to create a special btree (a regex btree) for a certain key in a
> json document that does some magic.

It depends on how “custom” the index needs to be. As Jonas said, CouchDB’s built-in indexing mechanism is called “views”. It’s fairly flexible — your map function can define any JSON value as a key for a document, and you can later query on specific keys or key ranges. This becomes especially powerful if you use arrays as keys, as it lets you set up primary/secondary search criteria.

But views aren’t all-powerful. Geospatial queries are one example of something regular views can’t handle, because they require range tests on multiple axes at once. That’s why they had to be added as a custom index type in CouchDB. I have no knowledge of how custom indexes are added, but I suspect it’s difficult (because it’s rarely done) and it would definitely require knowledge of Erlang.

Why don’t you describe your requirements in more detail. A lot of the time we can come up with a fairly clean way to implement people’s indexing needs using regular views — they’re surprisingly powerful.

—Jens