lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From László Monda <>
Subject Getting irrelevant results using fuzzy query
Date Tue, 17 Jun 2008 09:52:56 GMT
Hi guys,

I try to provide relevant results for the users of a lyrics site, even
in the case of misspellings by indexing artist and songs with Lucene.

The problem is that Lucene provides irrelevant search results.  For
example searching for "Coldplay" returns "Longplay" as the most relevant

This is how I create individual documents:

Document document = new Document();
document.add(new Field("artist", artist, Field.Store.YES,
document.add(new Field("song", song, Field.Store.YES,
document.add(new Field("path", path, Field.Store.YES, Field.Index.NO));

And this is how I compose the actual query:

BooleanQuery query = new BooleanQuery();
if (artist.length() > 0) {
    FuzzyQuery artist_query = new FuzzyQuery(new Term("artist",
    query.add(artist_query, BooleanClause.Occur.MUST);
if (song.length() > 0) {
    FuzzyQuery song_query = new FuzzyQuery(new Term("song", song));
    query.add(song_query, BooleanClause.Occur.MUST);

Please let me know what's wrong, I'd like to make this work right.

Thanks in advance!

Laci  <>

View raw message