1

I am using couchdb-lucene in my web application. I have a feature where I search for users.

Each user is a document with properties such as "Fullname", "Username" and "Activity".

Activity is just a float value that indicates how active that user is. So I want lucene to consider this factor as well while giving a score to each of the users. How do I do this ?

Eastern Monk
  • 6,395
  • 8
  • 46
  • 61

2 Answers2

0

While indexing, you may use the Document.setBoost() method. Also, you can do this not only on the Document level, it's also possible for one field of a Document by calling Field.setBoost().

dajood
  • 3,758
  • 9
  • 46
  • 68
  • You could also boost at query time. Query q = ...; q.setBoost(..); – Mikos Apr 29 '12 at 02:19
  • still confused about this being accepted as the answer. You cannot call 'Document.setBoost()' in couchdb-lucene. You have to add {"boost":boost_value} when you add the field. If this question is really about Lucene itself, then please change the description. – Robert Newson May 14 '12 at 14:22
0

You can boost things that you add to the Document as described at https://github.com/rnewson/couchdb-lucene/blob/master/README.md (search for "boost").

Robert Newson
  • 4,631
  • 20
  • 18