I use this to get a list of distinct value of a list type, here for the tags but it work for any other list field:
dv.pages().groupBy(p => p.tags).key.distinct()
So you can use :
dv.pages().where(p => p.class == "book").groupBy(p => p.genre).key.distinct()