29 May 2007 » Boosting terms in Zend Search Lucene
[tags]Zend, Zend Search Lucene, Search, Lucene, php, symfony, zsl[/tags]
Boosting terms — some fields are better than others
Lucene supports boosting or weighting terms. For example, if I search for members of a web site, and I type in
Dash, I want people with the name
Dash to take precendence over somebody who has a hobby of running the 50-yard Dash.
If we look at our
generateZSLDocument() method we defined we just need to adjust a few lines:
Should be turned into:
This is pretty straight forward way to add weight (1.5 times the weight of a normal term) and you can customize it to the needs of your site.