ENGAGE-294: Create a Couch view for search by object code

Metadata

Source
ENGAGE-294
Type
Sub-task
Priority
Major
Status
Closed
Resolution
Fixed
Assignee
Svetoslav Nedkov
Reporter
Michelle D'Souza
Created
2010-01-26T10:58:56.000-0500
Updated
2010-02-12T12:25:04.000-0500
Versions
N/A
Fixed Versions
  1. 0.3b
Component
  1. Object Code Entry

Description

We will require a Couch view in order to return artifact information to a user who has entered an object code on the object code entry screen.

Comments

  • Svetoslav Nedkov commented 2010-02-01T05:38:39.000-0500

    The following CouchDB view can be used for retrieval of artifacts based on artifact code.

    "by_object_code": {
    "defaults": {
    "store": "no"
    },
    "index": "function(doc) {var ret = new Document(); ret.add(doc.artefacts.code); return ret;}"
    }

    The code itself needs to be a string and put inside the 'artefacts' field of the document. For example:

    {
    "_id": ...,
    "rev": ...,
    "artefacts": {
    ...
    "code": "27",
    ...
    }
    }

  • Svetoslav Nedkov commented 2010-02-01T05:50:53.000-0500

    Looking through the above view I realized that there might be different artifacts in the artefacts field, so I changed the view a bit to nest the object code deeper into artefacts.artefact:

    "by_object_code": {
    "defaults": {
    "store": "no"
    },
    "index": "function(doc) {var ret = new Document(); ret.add(doc.artefacts.artefact.code); return ret;}"
    }

  • Justin Obara commented 2010-02-05T15:49:58.000-0500

    Bug Parade Engage 0.3

  • Justin Obara commented 2010-02-12T12:25:04.000-0500

    This is in couch and in the repository already.