Hi Colin, Justin,

I have reworked My Collection to support language switching. This involved changing the Lucene CouchDB view to support language queries as well as the native Couch view to return the McCord artifact ID. Another change is the new parametrized view in Engage config file that limits the returned documents to 256, otherwise CouchDB Lucene returns 25 documents as a maximum. When querying for artifacts by McCord ID the documents are returned in the order they were processed, i.e. by their UUID, so I had to reorder the artifacts in My Collection service.

Here is the Lucene view with language index:

  "by_id": {
      "defaults": {
          "store": "no"
      },
"index": "function(doc) {var ret=new Document(); ret.add(doc.artifact.id); ret.add(doc.artifact.lang); return ret;}"
  }


The native view that returns the McCord ID:

function (doc) {
   var artifact = doc.artifact;
   emit({
       'accessNumber': artifact.label.accessnumber,
       'lang': artifact.lang
   }, {
       'title': artifact.label.title || artifact.label.object,
       'artist': artifact.label.artist,
       'dated': artifact.label.dated,
       'medium': artifact.label.medium,
       'dimensions': artifact.label.dimensions,
       'mention': artifact.label.mention,
       'accessnumber': artifact.label.accessnumber,
       'description': artifact.description || "",
'mediaCount': artifact.mediafiles ? artifact.mediafiles.mediafile.length.toString() || "0" : "0", 'media': artifact.mediafiles ? artifact.mediafiles.mediafile || [] : [], 'commentsCount': artifact.comments ? artifact.comments.cnt || "0" : "0", 'comments': artifact.comments ? artifact.comments.comment || [] : [], 'relatedArtifactsCount': artifact.related_artifacts ? artifact.related_artifacts.cnt || "0" : "0", 'relatedArtifacts': artifact.related_artifacts ? artifact.related_artifacts.artifact || [] : [],
       'image': artifact.images ? artifact.images.image : [],
       'artifactId': artifact.id
   });
}



The patch is attached to:

http://issues.fluidproject.org/browse/ENGAGE-418



Regards,

Svetoslav
_______________________________________________________
fluid-work mailing list - [email protected]
To unsubscribe, change settings or access archives,
see http://fluidproject.org/mailman/listinfo/fluid-work

Reply via email to