I have a Cassandra table Department
with columns name_list extends SetColumn[String] with PartitionKey
and id extends StringColumn with PartitionKey
.
I want to fetch id where the requested name is present in name_list.
I tried using this code below but not getting any results
abstract class Departments extends Table[Departments, Department] with RootConnector {
object id extends StringColumn with PartitionKey
object dep_type extends StringColumn
object name_list extends SetColumn[String] with Index
def getByName(name: String) = {
select(_.id, _.name_list)
.where(_.name_list.contains(name))
.allowFiltering()
.one()
}
}
Is there any way to solve this!!
I think we do not need to extend Index for it. It is working fine with this too:-
Now, I am getting id and name_list by using the same method as above:-