There are two queries,one is created by QueryParser:
QueryParser parser = new QueryParser(field, analyzer);
Query query1 = parser.parse(\"Lucene\");
<
The QueryParser
parses the string and constructs a BooleanQuery
(afaik) consisting of BooleanClauses
and analyzes
the terms along the way.
The TermQuery
does NOT do analysis, and takes the term as-is. This is the main difference.
So the query1
and query2
might me equivalent (in a sense, that they provide the same search results) if the field
is the same, and the QueryParser's analyzer
is not changing the term.