In this chapter, we will go through the relevance calculation algorithm used by Solr for ranking results and understand how relevance calculation works with reference to the parameters in the algorithm. In addition to this, we will look at tweaking the algorithm and create our own algorithm for scoring results. Then, we will add it as a plugin to Solr and see how the search results are ranked. We will discuss the problems with the default algorithm used in Solr and define a new algorithm known called the information gain model. This chapter will incorporate the following topics:
The relevance calculation algorithm
Building a custom scorer
Drawback of the TF-IDF model
The information gain model
Implementing the information gain model
Options to TF-IDF similarity
BM25 similarity
DFR similarity