This is what I was looking for, but the DelegatingCollector 'finish' method doesn't exist in 4.3.0 :( Can this be patched in and are there any other PostFilter dependencies on 4.5?
Thanks, Peter On Wed, Dec 11, 2013 at 3:16 PM, Joel Bernstein <joels...@gmail.com> wrote: > Here is one approach to use in a postfilter > > 1) In the collect() method call score for each doc. Use the scores to > create your scaleInfo. > 2) Keep a bitset of the hits and a priorityQueue of your top X ScoreDocs. > 3) Don't delegate any documents to lower collectors in the collect() > method. > 4) In the finish method create a score mapping (use the hppc > IntFloatOpenHashMap) with your top X docIds pointing to their score, using > the priorityQueue created in step 2. Then iterate the bitset (also created > in step 2) sending down each doc to the lower collectors, retrieving and > scaling the score from the score map. If the document is not in the score > map then send down 0. > > You'll have setup a dummy scorer to feed to lower collectors. The > CollapsingQParserPlugin has an example of how to do this. > > > > > On Wed, Dec 11, 2013 at 2:05 PM, Peter Keegan <peterlkee...@gmail.com > >wrote: > > > Hi Joel, > > > > I thought about using a PostFilter, but the problem is that the 'scale' > > function must be done after all matching docs have been scored but before > > adding them to the PriorityQueue that sorts just the rows to be returned. > > Doing the 'scale' function wrapped in a 'query' is proving to be too slow > > when it visits every document in the index. > > > > In the Collector, I can see how to get the field values like this: > > > > > indexSearcher.getSchema().getField("field(myfield").getType().getValueSource(SchemaField, > > QParser).getValues() > > > > But, 'getValueSource' needs a QParser, which isn't available. > > And I can't create a QParser without a SolrQueryRequest, which isn't > > available. > > > > Thanks, > > Peter > > > > > > On Wed, Dec 11, 2013 at 1:48 PM, Joel Bernstein <joels...@gmail.com> > > wrote: > > > > > Peter, > > > > > > It sounds like you could achieve what you want to do in a PostFilter > > rather > > > then extending the TopDocsCollector. Is there a reason why a PostFilter > > > won't work for you? > > > > > > Joel > > > > > > > > > On Tue, Dec 10, 2013 at 3:24 PM, Peter Keegan <peterlkee...@gmail.com > > > >wrote: > > > > > > > Quick question: > > > > In the context of a custom collector, how does one get the values of > a > > > > field of type 'ExternalFileField'? > > > > > > > > Thanks, > > > > Peter > > > > > > > > > > > > On Tue, Dec 10, 2013 at 1:18 PM, Peter Keegan < > peterlkee...@gmail.com > > > > >wrote: > > > > > > > > > Hi Joel, > > > > > > > > > > This is related to another thread on function query matching ( > > > > > > > > > > > > > > > http://lucene.472066.n3.nabble.com/Function-query-matching-td4099807.html#a4105513 > > > > ). > > > > > The patch in SOLR-4465 will allow me to extend TopDocsCollector and > > > > perform > > > > > the 'scale' function on only the documents matching the main dismax > > > > query. > > > > > As you mention, it is a slightly intrusive design and requires > that I > > > > > manage my own PriorityQueue (and a local duplicate of HitQueue), > but > > > > should > > > > > work. I think a better design would hide the PQ from the plugin. > > > > > > > > > > Thanks, > > > > > Peter > > > > > > > > > > > > > > > On Sun, Dec 8, 2013 at 5:32 PM, Joel Bernstein <joels...@gmail.com > > > > > > wrote: > > > > > > > > > >> Hi Peter, > > > > >> > > > > >> I've been meaning to revisit configurable ranking collectors, but > I > > > > >> haven't > > > > >> yet had a chance. It's on the shortlist of things I'd like to > tackle > > > > >> though. > > > > >> > > > > >> > > > > >> > > > > >> On Fri, Dec 6, 2013 at 4:17 PM, Peter Keegan < > > peterlkee...@gmail.com> > > > > >> wrote: > > > > >> > > > > >> > I looked at SOLR-4465 and SOLR-5045, where it appears that there > > is > > > a > > > > >> goal > > > > >> > to be able to do custom sorting and ranking in a PostFilter. So > > far, > > > > it > > > > >> > looks like only custom aggregation can be implemented in > > PostFilter > > > > >> (5045). > > > > >> > Custom sorting/ranking can be done in a pluggable collector > > (4465), > > > > but > > > > >> > this patch is no longer in dev. > > > > >> > > > > > >> > Is there any other dev. being done on adding custom sorting > (after > > > > >> > collection) via a plugin? > > > > >> > > > > > >> > Thanks, > > > > >> > Peter > > > > >> > > > > > >> > > > > >> > > > > >> > > > > >> -- > > > > >> Joel Bernstein > > > > >> Search Engineer at Heliosearch > > > > >> > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > Joel Bernstein > > > Search Engineer at Heliosearch > > > > > > > > > -- > Joel Bernstein > Search Engineer at Heliosearch >