Lucene : How to give more importance to certain documents ?
-
04-06-2021 - |
Pergunta
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 ?
Solução
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()
.
Outras dicas
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").
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow