Mailing List Archive

fuzzy search with multiple terms

I am trying to get a fuzzy search to work, maybe I am not understanding
how it is supposed to work, can someone put me in the right direction? 
It seems to be always doing an OR when I use BooleanClause.Occur.MUST
(for loop).  Latest version of lucene.

eg for a term

stone brick

is it possible to do :

ston~ bric~

ie  fuzzy matching ston AND bric.  Small data set.

Cheers Greg


// Only searchable

document.add(new TextField(Constants.CONTENT_FIELD, content,


MultiFieldQueryParser queryParser = new MultiFieldQueryParser(
                    new String[]{Constants.CONTENT_FIELD}, analyzer);

BooleanQuery.Builder bQuery = new BooleanQuery.Builder();

// Order lines only
bQuery.add(new TermQuery(orderLines), BooleanClause.Occur.MUST);

BooleanQuery.Builder bQueryF = new BooleanQuery.Builder();

for (String term : terms) {

      // Fuzzy ~
      bQueryF.add(queryParser.parse(term + "~"), BooleanClause.Occur.MUST);

      // Term termfq = new Term(FieldConstants.CONTENT_FIELD, term);
      // FuzzyQuery fq = new FuzzyQuery(termfq,2,1);
      // bQueryF.add(fq, BooleanClause.Occur.MUST);

bQuery.add(, BooleanClause.Occur.MUST);


searchresults =, nMax, sorter);

To unsubscribe, e-mail:
For additional commands, e-mail: