The genres and book features are not mutually exclusive. So, make some attributes in the form of a
bitset. Something like that:
enum BookFeatureClassifiers {
Horror = 1 << 1,
Fantasy = 1 << 2,
Sex = 1 << 3,
History = 1 << 4,
}
Use bitwise OR operation to add an element (in the form of one of the enumeration members) to a set. (You did not indicate your language, so it could be '
And
' or '
|
'). To check up if a bit is set, use bitwise AND operation and compare the result with 0 (which means that the bit is clear, set otherwise).
To store it in a database, cast the enumeration value to an integer numeric value of sufficient size.
—SA