Is it possible to create an index of a set in Arangodb?
I have the following class:
public class Entity {
private String key;
private Set<String> projectKeys;
// Getter, Setter, ...
}
Assuming the entities {key: "1", projectKeys: ["1", "2"]} and {key: "2", projectKeys: ["2", "3"]} are stored in the database.
Now I want to search for all entities containing the value 3 in projectKey. This could be done by:
arangoDb.query(
"FOR e in @@collection " +
"FILTER @projectKey IN e.projectKeys " +
"RETURN e",
Map.of("@collection", "Entity",
"projectKey", projectKey),
Entity.class)
.asListRemaining();
My question is if it is possible to create an index on that collection which looks like:
// projectKey -> Entity
1 -> entity1
2 -> entity1, entity2
3 -> entity2
If yes, how can I do that?