Looks like you're storing hashes of query data but why not store the query object and implement a comparator function within Query? This would allow nice things like normalizing search queries, etc. (e.g. keywords: 'foo bar' should maybe one day match keywords: 'bar foo', but not for now).