tags:

views:

488

answers:

1

I have a document that contains a title and a description. One of the item description contains "Shipping is free with Amazon Prime" among other words.

I do a search with lucene for "Shipping is free with Amazon Prime" on the fields title and description using perl Lucene

my $analyzer = new Lucene::Analysis::SimpleAnalyzer();
my @fields = ('title', 'description');
my $parser = new Lucene::MultiFieldQueryParser(\@fields, $analyzer);

I get a score of 0.4 only. My guess is that I get 0 for title (no match), and 0.8 for description (exact match) for an average of 0.4.

How can I do a match on the title and/or description that would give me a score of 0.8 or more in this case?

+4  A: 

First, you need to look at some Lucene scoring theory. Next, explain() explains how a query got its score. I believe that Plucene has explain as well. Third, why does the score have to be 0.8 or more? Lucene scores are relative and are valid in the context of a specific query. Their main use is to order hits. Unless you need the score for another purpose, and as long as the relative order stays the same, I would not care about the absolute score.

Yuval F
I was trying to keep the best matches only, above some threshold
Julien