1

When I look at the Zend framework documentation, Zend Search Lucene has the ability to boost search terms.

Is there a way to boost fields? That is, make hits in a field more relevant than others?

Example:

Document1
Name: Jane Doe
Description: Wife of John Doe

Document2
Name: John Doe
Description: Husband of Jane Doe

Search query = "John Doe"

In this example, I want to boost "Name" field because it is more relevant. The search results should list Document2 first rather than Document1

Charles
  • 50,943
  • 13
  • 104
  • 142
developarvin
  • 4,940
  • 12
  • 54
  • 100
  • I read both Jane and John as John. Was thinking whats the difference between the 2 documents!! – Raj Nov 17 '11 at 17:35

1 Answers1

2

Yes, use the setBoost method of the field. (I'm not familiar with Zend's implementation, but I assume they have an equivalent method.)

Xodarap
  • 11,581
  • 11
  • 56
  • 94
  • Found out that they don't have a method for this in their document field class. But upon further inspection, they do have a public boost property in that class. I don't know why they didn't make a setBoost() method for it. I guess setting them directly is ok. – developarvin Nov 18 '11 at 02:15