Associations with the targetStoragetType set to Cassandra have some restrictions on searching. Since the association is resolved via adding a search for either eq to the respective foreignkey or in the foreignkey array in case the association is of type many_to_many. Cassandra does not allow multiple Equal restrictions on the id field, the driver will throw an Error. To circumvent that a workaround where searches on the idField are merged with the search on the foreignkey(s) is implemented.
Be aware that the workaround only works because cassandra does not support the OR operator. There are also the following pitfalls to consider:
cassandra does not allow SELECT queries on indexed columns with IN clause for the PRIMARY KEY.
If there are multiple Equal restrictions on the id field cassandra will throw an Error.
multiple searches on the idAttribute field will still throw the above Error since search nodes are merged one-by-one with the foreignkey(s).
This workaround is only for associations where the foreignKey is stored on the side of the cassandra model, since IN clauses are only allowed on the primarykey column, not on any foreignkey column.
Related PRs
Additional Changes
fix a bug in the cassandra migration where indeces on columns with camelCase name where not correctly generated
fix a bug where the fieldMutation for to_many associations where not generated in case of cassandra-adapter
Summary
Closes #186
Associations with the
targetStoragetType
set to Cassandra have some restrictions on searching. Since the association is resolved via adding a search for eithereq
to the respective foreignkey orin
the foreignkey array in case the association is of typemany_to_many
. Cassandra does not allow multiple Equal restrictions on the id field, the driver will throw an Error. To circumvent that a workaround where searches on the idField are merged with the search on the foreignkey(s) is implemented.Be aware that the workaround only works because cassandra does not support the OR operator. There are also the following pitfalls to consider:
cassandra does not allow SELECT queries on indexed columns with IN clause for the PRIMARY KEY.
If there are multiple Equal restrictions on the id field cassandra will throw an Error.
multiple searches on the idAttribute field will still throw the above Error since search nodes are merged one-by-one with the foreignkey(s).
This workaround is only for associations where the foreignKey is stored on the side of the cassandra model, since IN clauses are only allowed on the primarykey column, not on any foreignkey column.
Related PRs
Additional Changes
to_many
associations where not generated in case of cassandra-adapter