You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Ryan Aslett <Ry...@Qsent.com> on 2005/01/14 20:17:40 UTC
Boolean Query
Okay, Im not grokking something here. Im trying to run a query that
returns only the results that have *all* of the terms in my query
string.
When I run this query, which I construct myself and do a
Analyzer analyzer = new WhitespaceAnalyzer();
QueryParser qp = new QueryParser("address", analyzer);
Query addyQ = qp.parse(queryString);
I get the following in addyQ.toString:
Query: +address:122 +address:N +address:30th +address:St
0 total matching documents in 19 ms
So the querystring is unchanged from what I created, and I get zilch.
However, when I do this:
Analyzer analyzer = new WhitespaceAnalyzer();
BooleanQuery baQ = new BooleanQuery();
Query parsedAddyQ = qp.parse("122 N 30th St");
baQ.add(parsedAddyQ, true, false);
I get this:
Query: +(address:122 address:N address:30th address:St)
62 total matching documents in 8 ms
0. 122 N 30th St
1. PO Box 122
2. PO Box 122
3. 122 N 9th St
4. 122 S Clay Ave
5. 122 E 3rd St
...
So.. I want that first result, I know its in there, its matching as the
highest match, but not when I require all 4 tokens? What gives? What am
I doing wrong?
Also, if it matters Im running the query on a parallelMultiSearcher with
280 indexes of 1 million records each.
Ryan
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org