Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
New, Patch Available
Description
It's sometimes difficult to debug a query that results in a MatchNoDocsQuery. The MatchNoDocsQuery is always rewritten in an empty boolean query.
This patch adds an optional reason and implements a weight in order to keep track of the reason why the query did not match any document. The reason is printed on toString and when an explanation for noMatch is asked.
For instance the query:
new MatchNoDocsQuery("Field not found").toString()
=> 'MatchNoDocsQuery["field 'title' not found"]'