lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From George Kelvin <george.kelvin...@gmail.com>
Subject Re: Questions about FuzzyQuery in Lucene 4.x
Date Tue, 29 Jan 2013 16:49:35 GMT
Hi Jack,

Thanks for your reply!

I don't think I passed the prefixLength parameter in.

Here is the code I used to build the FuzzyQuery:

            String[] words = str.split("\\+");
            BooleanQuery query = new BooleanQuery();

            for (int i=0; i<words.length; i++)
            {
                Term t = new Term(field, words[i]);
                FuzzyQuery fq = new FuzzyQuery(t, ed);
                query.add(fq, BooleanClause.Occur.MUST);
            }

            int k = 10;
            TopDocs results = searcher.search(query, k);

Does it look right to you?

Thanks!

George

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