linkedin/sensei — pull request #88 by nsabovic (2013-11-18 18:45:36+00:00)
Title: Added a query planner.

Added the ability to show the actual query plan during execution. Currently requires uncommenting some code, because logging query plans is expensive.
Sensei filters learned to estimate cardinality in order to optimize filter execution order and traverse fewer documents. Specifically, this info is used during ANDs, ORs, and term searches that use facet cache. For ANDs, filters are rearranged so that the lowest-cardinality filters come first, and always-true filters are dropped. For ORs, highest cardinality filters come first, and always-false filters are dropped. Cardinality is tracked as a range (as opposed to Bobo's single-number selectivity), which gives a bit more accurate results.