Given an instance of `Query` is it possible to somehow check whether that instance happens to represent a query that always matches all the documents in the index?

For example, a `MatchAllDocsQuery` or a `BooleanQuery` that contains a `MatchAllDocs` clause are such queries that always return all the documents. Another example is a `BooleanQuery` that has a SHOULD-match clause that has a nested SHOULD-match clause that has a `MatchAllDocs` inside it.

Note that a query that happens to return everything because it has all the possible terms in it or because the index is empty doesn't count as a query that always return all the documents. In other words, I would like to check whether a given query always returns everything no matter what the index contains.

Is it possible or at least approximately possible? I'll accept an answer with a solution that doesn't work for any conceivable case if it works for any query that can be returned from [Solr's Extended Dismax Query Parser](http://lucene.apache.org/solr/4_5_1/solr-core/org/apache/solr/search/ExtendedDismaxQParser.ExtendedSolrQueryParser.html).