0

For eg., say i have a ArrayList of book items. Book items have attributes book_title, book_author, and book_isbn.

I also have a simple string search query "query_str" (say).

How can i sort the ArrayList of book objects, based on search relevance of either book_title, book_author with "query_str"?

I am an application developer, not very experience with search ranking algorithms, but I found Lucene very interesting. The problem is, it is straightforward to sort a list of strings... but how to do it for a list of objects? (Maybe use the toString() method)

How do i get started with Lucene for this?

Shubham Kanodia
  • 6,036
  • 3
  • 32
  • 46

1 Answers1

0

By default, when you search in Lucene, the results are sorted on relevance. If you want to use some field in particular to be used in relevance (scoring), lucene provides way to boost score. Just search for "boosting in lucene". - Query level boosting might be the best fit for your case.

Rajat Garg
  • 355
  • 1
  • 2
  • 11