johnl / xapian-fu

A nicer Ruby interface for the Xapian full text indexer
https://www.rubydoc.info/github/johnl/xapian-fu
Other
51 stars 15 forks source link

Adds support for term weights when indexing #17

Closed ragalie closed 12 years ago

ragalie commented 12 years ago

Xapian supports adding extra weight to certain terms as part of the indexing process.

This commit adds a :weights option to XapianDb.new which takes a function that returns an integer weight value for the given key and value. This weight value is then passed to the TermGenerator as part of the index_text process.

If a weights function isn't provided, the current default of 1 is passed instead.

johnl commented 12 years ago

nice work, thanks for the contribution!