I think you'll have to handle the complexities you describe if you use the RankQuery.
The RankQuery does bring with it a fair amount of complexity to get everything right. The ReRankQParserPlugin provides a pretty good example to review. Joel Bernstein http://joelsolr.blogspot.com/ On Fri, Jul 15, 2016 at 8:07 AM, Ankit Singh <an...@zettata.com> wrote: > Hi, > > I am trying to understand how to influence scoring via RankQuery in solr >= > 4.9. My requirements are two fold: > > 1) Use a custom collector > 2) Change scoring of docs > > As far as i could understand, if we just want to change the scoring, we can > write a QueryParserPlugin and extend CustomScoreQuery to introduce a > CustomScoreProvider and modify the customScore method so that whenever we > call scorer.score(), this new custom scorer would be used. This works > perfectly in isolation (not using RankQuery). > > However, i want to use a custom scorer in my query object extending > RankQuery (where i am setting a custom collector). One way to do this is to > override the setScorer method and initialise an object of the new scorer > here. The problem i'm experiencing here is that to modify the scoring > explanation, i would need to rewrite the weight class which is one > complexity i am trying to avoid. I would need the same scorer in a > post-filter i wrote, and going by this method, i would need to set the > scorer even in the post-filter. > > Is there another way to change scoring of docs while also using RankQuery > API, which lets us change the explanation in an easier way? > > Regards, > Ankit Singh >