Prefer isinstance() to hasattr()
Dropped encode_json, decode_json
Facet refactoring
Query refactoring