[Xapian-tickets] [Xapian] #340: PostingSource subclasses cannot signal a change in their maxweight

Xapian nobody at xapian.org
Wed Mar 4 00:09:27 GMT 2009


#340: PostingSource subclasses cannot signal a change in their maxweight
-------------------------+--------------------------------------------------
 Reporter:  richard      |       Owner:  olly     
     Type:  defect       |      Status:  new      
 Priority:  normal       |   Milestone:  1.1.0    
Component:  Library API  |     Version:  SVN trunk
 Severity:  normal       |   Blockedby:           
 Platform:  All          |    Blocking:           
-------------------------+--------------------------------------------------
 Currently, PostingSource subclasses have a get_maxweight() method, which
 is called once at the start of a search to determine the maximum possible
 weight returned by the posting source.

 However, it is possible that some PostingSource subclasses may know that
 the maximum possible returned weight has decreased at certain points
 during the match process.  I'm working on one such postingsource at
 present, which returns monotonically decreasing weights as the match
 proceeds.

 It would be nice if such postingsource subclasses could notify the matcher
 that their maximum weight (from this point onward) has decreased.
 Internally, PostList classes do this by calling matcher->recalc_maxweight,
 but the postingsource classes don't have access to the matcher object.

 I'm not sure what the best API for this would be: one option is to add
 something like the following to the PostingSource base class:

 {{{
   private:
     friend ExternalPostlist;
     ExternalPostlist * externalpl;
     void register_externalpl(ExternalPostlist * externalpl_) {
         externalpl = externalpl_;
     }
   protected:
     void notify_new_maxweight();
 }}}

 where notify_new_maxweight() does something like:

 {{{
     externalpl->recalc_maxweight();
 }}}

 ExternalPostlist would register itself with the posting source before use,
 and would pass the recalc_maxweight() message on to the matcher when
 called.

 Or, we could pass some proxy object to the reset() method, which the
 posting source could remember and use to call recalc_maxweight() if
 needed, or ignore if not needed.

 Better ideas welcomed.

 Marking for 1.1.0 since this might require us to change the PostingSource
 API.

-- 
Ticket URL: <http://trac.xapian.org/ticket/340>
Xapian <http://xapian.org/>
Xapian



More information about the Xapian-tickets mailing list