Hi, Actually, the MatchAllQuery, for all I know (since it is invoked by the client) can be wrapped in a Bool Query type. Hence, it is difficult for me to traverse the Bool Query clauses and determine MatchAll, whereas there may be other clauses which do contain a TermQuery or a NumericRangeQuery in which case a MatchAllQuery check is futile. Given any query, Bool Query or MatchAll, or a specific subclass of Query, what would be the safe way to determine that this is not a MatchAll query without any terms, or whether this is a query that contains at least one term or range? -----------------------Thanks n Regards, Sandeep Ramesh Khanzode
On Saturday, November 28, 2015 12:30 PM, Michael Wilkowski <m...@silenteight.com> wrote: Instanceof? MW Sent from Mi phone On 28 Nov 2015 06:57, "Sandeep Khanzode" <sandeep_khanz...@yahoo.com.invalid> wrote: > Hi, > I have a question. > In my program, I need to check whether the input query is a MatchAll Query > that contains no terms, or a Query (any variant) that has at least one > term. For typical Term queries, this seems reasonable to be done with > Query.extractTerms(Set<> terms) which gives the list of terms. > However, when there is a NumericRangeQuery, this method throws an > UnsupportedOperationException. > How can I determine that a NumericRangeQuery or any non-Term query exists > in the Input Query and differentiate it from the MatchAllQuery? -- SRK