I am reading this piece of source code.
This looks good but what if instead of artist, the field was "artists" where artists was an list<text>
in cassandra?
I found this article which talks about using ListColumn
https://github.com/websudos/phantom/wiki/Collection-columns
but I am not sure how will you define index on the ListColumn
object genre extends ListColumn(this) with Index[List[String]]
The line above does not compile.
As far as I'm aware you can only do contains queries with secondary indexes on Set columns, not List.
Here's what you do:
object genre extends SetColumn[Table, Record, Int](this) with Index[Set[Int]]
. The 2 typesTable
andRecord
have to match what you provided when you extendedCassandraTable
just above, like this:Hope this makes sense. Careful with
ListColumn
too, all collection columns need theTableType
andRecordType
arguments.Update
In more recent versions of phantom, you don't need to provide the type of the table and the record. Just do the following:
Look at this test for examples on using indexed collections, and then at this table for an example on how to define such tables.
Regards.