This is probably happening because there are no terms in your index that match "gloves*".
When a MultiTermQuery
is rewritten, it finds the Terms that are suitable, and creates primitive queries (such as TermQuery
) on those terms. If no suitable terms are found, you'll see an empty query generated instead, like what you've shown.
A TermQuery is already a primitive query, and no rewriting is needed there. It doesn't have to enumerate terms or anything, it just runs the thing.
The other piece of this is analysis. Your query for gloves
is getting analyzed to glove
(EnglishAnalyzer
perhaps?). MultiTermQueries
(like wildcard, fuzzy, regex and prefix queries) are not analyzed by the QueryParser
. Your prefix query is trying to find " "gloves", but all those plural s
, have been stemmed away, so it doesn't find any matches.