I'm looking to implement both the MinimumShouldMatch and the CommonTermsQuery (in their basic forms) in my own search system purely for benchmarking purposes.
I have sifted through the source code but am unsure on the implementation details of these queries.
I assume the CommonTermsQuery just processes the "rare" terms as a ranked disjunctive query, and then iterates the postings lists for the common terms, but only visiting and updating the scores for the docid's in the top-k list? I read that if only common terms are supplied, the query is ran as a ranked conjunction.
As for the MinimumShouldMatch query, I assume this is implemented as a ranked disjunction with the added check that there are at least n matching terms before processing a candidate document?
In addition, does ES use a dynamic pruning strategy for additional efficiency, ala Maxscore or Wand?