views:

74

answers:

1

Hi,

Is it possible to set the relevance of the fields indexed by Zend Lucene? I have an article search, searching title, author and body, but, although the title is indexed, when I search by title I do not get the article. I would like to say to Lucene to give a higher relevance to the title

+1  A: 

You should be able to modify the scoring with a custom Zend_Search_Lucene_Search_Similarity extension: http://framework.zend.com/manual/en/zend.search.lucene.extending.html#zend.search.lucene.extending.scoring

Typeoneerror
I had a look how to extend the similarity class, but I still have no idea how to increase the score for the title.
rtacconi
Sorry, actually I can do that by overriing this function: public function lengthNorm($fieldName, $numTerms) { return 1.0/sqrt($numTerms); }Thanks.
rtacconi
Nice, I actually haven't messed with this yet; just saw it was an option when setting up my search indexes.
Typeoneerror