incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthieu Rakotojaona <matthieu.rakotoja...@gmail.com>
Subject Re: FW: Am I doing something fundamentally wrong?
Date Fri, 25 May 2012 14:20:18 GMT
Mike,

No, indeed, emitting the whole doc in either key or value would be a
foolish idea =]
I suggested that you emit the "maven-build-profile" string. Supposing
the view woulb be called "by_activity", you will then be able to query
the view like that :

GET /dbname/_design/ddoc/_view/by_activity?key="maven-build-profile"

This will give you access to all the docs for which you emitted the
string. In fact the string emitting serves as the filtering you need.
This output is then fed as-is into the list; that is why you'll want
to use "&include_docs=true" to add the whole document to the data that
is fed into the list.

I think you see now that you can replace this very simple view with
the couchdb-integrated "_all_docs" view, if all your docs have the
"maven-build-profile" property. The view I suggested needs very few
hard disk space, but the "_all_docs" requires even less because it's 0
=]

Now, for the CPU usage part, as a few emails in this mailing list have
said, it might be an issue with the translation of the documents from
disk format to JSON to parse them in the map function. I don't know
about erlang views[0], but if the view is very simple, you could try
it : I believe there is no translation to JSON, the docs are directly
read from disk and parsed through the view. If it does behave like
that, you will highly benefit from it, because your docs are very
huge, and have to be completely translated before parsing.

But in the end, you are just working around the somewhat static nature
of CouchDB; as advised, a full-text search engine[1] should be more
adapted to what you want to do.

[0] http://wiki.apache.org/couchdb/EnableErlangViews
[1] http://wiki.apache.org/couchdb/Full_text_search

-- 
Matthieu RAKOTOJAONA

Mime
View raw message