I'm not extremely familiar with Lucene, so I am confused at why the
following behavior is happening:
When I build up a BooleanQuery using the Lucene objects (combination of
RangeQueries, TermQuery, etc.) I am getting a different result than when
I do a QueryParser.parse(queryString).
The BooleanQuery that I build up produces the following output:
String queryString = baseQuery.toString();
Output: +date_received:[20030301 TO 20090913] +type:O24337
+(site_domains_reversed:moc.rettiwt site_domains_reversed:moc.rettiwt.*)
Hits results = indexSearcher.search(baseQuery);
Output: results.length = 0
-------------
However, if I do the following, I get results:
QueryParser stringParser = new QueryParser(LUCENE_SEARCH_FIELD,
PuntEmailIndexHelper.getAnalyzer());
Query parsedQuery = stringParser.parse(baseQuery.toString());
Hits results = indexSearcher.search(parsedQuery);
Output: results.length = 3
My question is, why are the results different?? The query in both cases
is the same, the only difference is that one was "built-up" while the
other one was "parsed" based upon the .toString() method of the built-up
query...
Hopefully, this is making sense and someone can explain why the results
are different.
Thanks for your help.
Chris Adams
Senior Software Engineer
Email Data Source, Inc.
816-448-2045
chris@emaildatasource.com
EmailDataSource.com <http://www.emaildatasource.com/> | 5 of the top
20 internet retailers use Email Data Source
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
|