substance / archivist-composer

A composer for interviews, used by the archivist project
MIT License
2 stars 0 forks source link

Problems with GraphIndexes on array properties #4

Closed michael closed 9 years ago

michael commented 9 years ago

For subject references we use an array for the target property of a reference/annotation.

    "subject_reference_1": {
      "id": "subject_reference_1",
      "type": "subject_reference",
      "path": [
        "text_54",
        "content"
      ],
      "target": ["54bae4cda868bc6fab4bcd0e", "54bae99ca868bc3ec7fb5ad8"], // these are external objects
      "range": [
        85,
        95
      ]
    },

I also created an index to look up subject references by target.

  // Index subject references (multi-annotations)
  this.subjectReferencesIndex = this.addIndex('subjectReferencesIndex', {
    types: ["subject_reference"],
    property: "target"
  });

Now when i employ this index, i only get results for the first entry of the array.

doc.subjectReferencesIndex.get("54bae4cda868bc6fab4bcd0e")); // => ["subject_reference_1"]

doc.subjectReferencesIndex.get("54bae99ca868bc3ec7fb5ad8")); // => []
michael commented 9 years ago

Fixed.