The finish method would still be a problem using the func qparser. Out of curiosity, why do you need to call close on the scorer?
Joel Bernstein http://joelsolr.blogspot.com/ On Wed, Jun 3, 2015 at 10:53 AM, Joel Bernstein <joels...@gmail.com> wrote: > I think there are easier ways to do what you are trying to do. > > Take a look at the Function query parser. > > It will allow you to control the score for each document from within a > function query. The basic use case is this: > > q={!func}myFunc()&fq=my+query > > In this scenario the func qparser plugin controls the score and the fq > provides the query. > > > > > > > Joel Bernstein > http://joelsolr.blogspot.com/ > > On Wed, Jun 3, 2015 at 9:50 AM, adfel70 <adfe...@gmail.com> wrote: > >> Hi guys, need your help (again): >> I have a search handler which need to override solr's scoring. I chose to >> implement it with RankQuery API, so when getTopDocsCollector() gets called >> it instantiates my TopDocsCollector instance, and every dicId gets its own >> score: >> >> public class MyScorerrankQuet extends RankQuery { >> ... >> >> @Override >> public TopDocsCollector getTopDocsCollector(int i, >> SolrIndexerSearcher.QueryCommand cmd, IndexSearcher searcher) { >> ... >> return new MyCollector(...) >> } >> } >> >> public class MyCollector extends TopDocsCollector{ >> //Initialized in constrctor >> MyScorer scorer; >> >> public MyCollector(){ >> scorer = new MyScorer(); >> scorer.start(); //the scorer's API needs to call >> start() before every >> query and close() at the end of the query >> } >> >> @Override >> public void collect(int id){ >> //1. get specific field from the doc using DocValues and >> calculate score >> using my scorer >> //2. add docId and score (ScoreDoc object) into >> PriorityQueue. >> } >> } >> >> My problem is that I cant find a place to call scorer.close(), which need >> to >> be executed when the query ends (after we calculated score for each >> docID). >> I saw the DeligatingCollector has finish() method which is called after >> collector is done, but I cannot extend both TopDocsCollector and >> DeligatingCollector... >> >> >> >> >> >> -- >> View this message in context: >> http://lucene.472066.n3.nabble.com/How-to-tell-when-Collector-finishes-collect-loop-tp4209447.html >> Sent from the Solr - User mailing list archive at Nabble.com. >> > >