lucenecouchdbcouchdb-lucene

Lucene : How to give more importance to certain documents ?


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 ?


Solution

  • 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().