Hi,
consider that the multifieldQueryParser is just a parser, after that it's still optimized.
To have it rewrite the query, either use Luke or write some code like:
Code:
SearchFactory searchFactory = session.getSearchFactory();
DirectoryProvider[] directoryProviders = searchFactory.getDirectoryProviders( Product.class );
IndexReader indexReader = searchFactory.getReaderProvider().openReader( directoryProviders );
System.out.println("toString2: " + query.rewrite( indexReader ).toString());
searchFactory.getReaderProvider().closeReader( indexReader );
But this is only useful for inspection, it's done automatically before the Query is performed.
Look at how a RangeQuery is rewritten, that is scary.
Quote:
(field:word field:word)
that doesn't seem right, but I don't think it's your fault. It will work correctly; it's likely going to affect the scoring but will be relative to all results so it won't affect order of results either.
For better answers about the QueryParsers I'd suggest you to send a mail to Lucene mailing list (thay don't have a forum, but do archive emails):
http://lucene.apache.org/java/docs/mailinglists.htmlI think they could fix this, or explain why it does like you saw.