[ https://issues.apache.org/jira/browse/LUCENE-6587?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alan Woodward updated LUCENE-6587: ---------------------------------- Attachment: LUCENE-6587.patch Here's a patch. Weight.explain(LeafReaderContext, int) is final, pulling a Scorer, advancing to the relevant doc, and calling scorer.explain(). There's a new explainMiss(LRC, int) method which is called if the document doesn't match, with a default implementation. BooleanWeight overrides this. There's a nocommit around what to do with query rescorers. I don't really want to make Weight.explain() overrideable, which is the easiest way to deal with them, but I'm not sure that there's any better way of doing it. All lucene tests pass, will look at the Solr ones presently. > Move explain() to Scorer > ------------------------ > > Key: LUCENE-6587 > URL: https://issues.apache.org/jira/browse/LUCENE-6587 > Project: Lucene - Core > Issue Type: Improvement > Reporter: Alan Woodward > Attachments: LUCENE-6587.patch > > > At the moment, the explanation API is on Weight, rather than on Scorer. This > has a number of disadvantages: > * It means that Weights need to know about the scoring algorithms of their > child scorers, which results in a leaky API (for example, the > SloppyPhraseScorer has a package-private sloppyFreq() method which is only > used by PhraseWeight.explain(), and SpanScorer has a similar public method > that is again only called by explanation functions) > * It leads to lots of duplicated code - more or less every Weight.explain() > method creates a Scorer, advances to the appropriate doc, and checks for a > match > * It's very slow, because we create a new Scorer for every document > I'd like to try moving explain() directly to Scorer. We can keep the old > slow IndexSearcher.explain() API, but in addition explanations could now be > generated efficiently in a Collector. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org