lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "no spam" <mrs.nos...@gmail.com>
Subject default AND operator
Date Sun, 17 Sep 2006 02:02:11 GMT
Why does my query "french AND antiques" work the way I expect using this
code:

  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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message