[Xapian-tickets] [Xapian] #183: Add MatchSpy class distinct from MatchDecider with support for remote use

Xapian nobody at xapian.org
Tue Jul 7 08:35:57 BST 2009


#183: Add MatchSpy class distinct from MatchDecider with support for remote use
----------------------------+-----------------------------------------------
 Reporter:  richard         |        Owner:  richard  
     Type:  defect          |       Status:  assigned 
 Priority:  normal          |    Milestone:  1.1.4    
Component:  Backend-Remote  |      Version:  SVN trunk
 Severity:  normal          |   Resolution:           
 Keywords:                  |    Blockedby:           
 Platform:  All             |     Blocking:           
----------------------------+-----------------------------------------------

Comment(by richard):

 Yes, planning to merge this with the matchspy branch now.

 I spent about an hour trying to come up with a solution for the overloaded
 get_mset() thing; the best I could come up with was adding the MatchSpy
 option as a pass-by-reference signature with no default - this way it's
 never ambiguous.  ie, add:

 {{{
 MSet get_mset(Xapian::doccount first,
               Xapian::doccount maxitems,
               Xapian::doccount checkatleast,
               const RSet * omrset,
               MatchSpy & matchspy) const;
 }}}

 I'm not sure whether this is bad, really; passing by reference seems
 cleaner, somehow.  However, using pointer allows the caller to build up
 things like the matchspy parameter, and use the default value of NULL if
 no matchspy is wanted.  This signature is likely to lead to lots of code
 like:

 {{{
 if (matchspy_ptr != NULL) {
     mset = enq.get_mset(0, 10, 0, NULL, *matchspy);
 } else {
     mset = enq.get_mset(0, 10, 0, NULL);
 }
 }}}

 which seems a shame.

-- 
Ticket URL: <http://trac.xapian.org/ticket/183#comment:9>
Xapian <http://xapian.org/>
Xapian



More information about the Xapian-tickets mailing list