lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: default AND operator
Date Sun, 17 Sep 2006 03:49:10 GMT

: Why does my query "french AND antiques" work the way I expect using this
: code:

can you be more specific about what it is you "expect", and what exactly
serachTerms is in your examples?  (presumably it's a string, is it the
string "french AND antiques" ... are you sure it's not "french and
antiques" ? ... QueryParser only respects AND and OR if they are
capitalized, otherwise they are treated as normal words, which are
probably StopWords to your analyzer .. in which case everything you've
shown makes perfect sense to me.)


 :
:   stemParser = new QueryParser("contents", stemmingAnalyzer);
:   Query query = stemParser.parse(searchTerms);
:   Hits docHits = searcher.search(query);
:
: Debug from query shows: contents:french contents:antiqu  ... I would have
: expected to see '+' before contents.
:
: But not if I try the query again with "french antiques" with this code ...
: which sets the default operator to AND:
:
:    stemParser = new QueryParser("contents", stemmingAnalyzer);
:   stemParser.setDefaultOperator(QueryParser.Operator.AND);
:   Query query = stemParser.parse(searchTerms);
:   Hits docHits = searcher.search(query);
:
: Debug from Query shows this:  +contents:french +contents:antiqu
:



-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message