Now uses Trie, potentially faster (can do prefix lookups instead of full
predicate scans).