Mailing List Archive

Question - ClassicSimilarity method not being called
Hi all
I'm re-reading Lucene in Action and decided to update the source code to
use Lucene 9.5.0 just for fun (seemed like a good idea at the time). Source
code can be found on Github here
<https://github.com/shaikhu/lucene_in_action>.

I'm running into trouble with one of the examples from Chapter 6 "Extending
Search" , specifically trying to get my own custom similarity class
executed. See BoostSimilarity.java
<https://github.com/shaikhu/lucene_in_action/blob/fa1f8ab48090f98a7c9ab57054ede69ac7b68351/extsearch/src/main/java/lia/payloads/BoostingSimilarity.java#L8>.
I've noticed with version 9.5.0 the scorePayload method is no longer
available. Is it still possible to use ClassicSimilarity, or do I need to
use BM25Similarity? I thought by using a SpanQuery
<https://github.com/shaikhu/lucene_in_action/blob/fa1f8ab48090f98a7c9ab57054ede69ac7b68351/extsearch/src/test/java/lia/payloads/PayloadsTest.java#L69>
wrapped inside a PayloadScoreQuery
<https://github.com/shaikhu/lucene_in_action/blob/fa1f8ab48090f98a7c9ab57054ede69ac7b68351/extsearch/src/test/java/lia/payloads/PayloadsTest.java#L74>
it might work, but no such luck.

Is trying to read the payload during searching (from a custom simiarity
class) still possible/advisable? Or is this example just no longer
relevant?

The second assertion
<https://github.com/shaikhu/lucene_in_action/blob/fa1f8ab48090f98a7c9ab57054ede69ac7b68351/extsearch/src/test/java/lia/payloads/PayloadsTest.java#L76>
is failing. The document "warning label maker" should be returned lower,
because the other two documents should be boosted high (using the payload).
This isn't happening.

Sorry if my question isn't clear, hopefully the unit test is.

Thanks
Usman Shaikh