lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack Krupansky" <j...@basetechnology.com>
Subject Re: Questions about FuzzyQuery in Lucene 4.x
Date Tue, 29 Jan 2013 17:10:19 GMT
That depends on the value of "ed", and the indexed data.

Another factor to take into consideration is that a case change ("Star" vs. 
"star") also counts as an edit.

-- Jack Krupansky

-----Original Message----- 
From: George Kelvin
Sent: Tuesday, January 29, 2013 11:49 AM
To: java-user@lucene.apache.org
Subject: Re: Questions about FuzzyQuery in Lucene 4.x

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 


---------------------------------------------------------------------
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