Building your own Lucene Scorer
Please read full article from Building your own Lucene Scorer
When you create a new IndexSearcher, by default Lucene uses DefaultSimilarity, which is actually cosine similarity (in a Vector Space Model) with different weights such as boosts given when indexing, boosts given in the query, tf*idf and document length norm. A description on how it works exactly can be found on Similarity class documentation and on Lucene Score documentation.
The guys from Lucene have put a lot of effort into finding a good similarity function and theirDefaultSimilarity works quite well on most of the cases. However, for one reason or another you may still want to use your own custom function.
To be clear, you’re not creating a custom Scorer, you’re creating a CustomScoreProvider. I think you mean to use “Scorer” in a general sense but in Lucene it’s an actual class name that is implemented much differently than a CustomScoreProvider.