Engage: Handing in My Collection
Svetoslav Nedkov
snedkov at asteasolutions.com
Fri Feb 5 19:03:41 UTC 2010
Hi Colin,
My branch should be not too much trouble to merge now, there are some
changes I've done to artifact service and client side and also in
Engage.js adding the couch id to the model.
To get things running first the database server needs to be updated with
a new database "users". For this database I've used the following views:
{
"by_user_collection": {
"defaults": {
"store": "no"
},
"index": "function(doc) {var ret=new Document();
ret.add(doc.type); ret.add(doc._id); return ret;}"
},
"by_user_artifact": {
"defaults": {
"store": "no"
},
"index": "function(doc) {var ret=new Document();
ret.add(doc.type); ret.add(doc._id); for (var idx in
doc.collection.artifacts) {ret.add(doc.collection.artifacts[idx].id)}
return ret;}"
}
}
The first one could possibly be replaced by a simple query that
addresses one single document in the database, because the only thing
that it does beside that is look for a type field.
The second one I use to look up the collection based on an artifact id
and is used in the artifact service to check if there is a collection
for the current user containing the current artifact.
Then I've added a query in the museum database:
"by_id": {
"defaults": {
"store": "no"
},
"index": "function(doc) {var ret=new Document();
ret.add(doc._id); return ret;}"
},
that I use to retrieve an "OR"-ed list of artifacts with lucene.
Hope this helps.
Regards,
Svetoslav
More information about the fluid-work
mailing list