[Xapian-tickets] [Xapian] #467: Extend get_eset() signature to include optional prefix argument

Xapian nobody at xapian.org
Sun Jan 16 11:43:14 GMT 2011


#467: Extend get_eset() signature to include optional prefix argument
-------------------------+--------------------------------------------------
 Reporter:  michelp      |       Owner:  olly 
     Type:  enhancement  |      Status:  new  
 Priority:  normal       |   Milestone:  1.2.x
Component:  Library API  |     Version:       
 Severity:  normal       |    Keywords:       
Blockedby:               |    Platform:  All  
 Blocking:               |  
-------------------------+--------------------------------------------------
Changes (by olly):

  * milestone:  => 1.2.x


Old description:

> Suggest Enquire.get_eset arguments include 'prefix' that rejects terms
> early that do not begin with the argument value.  My personal use case is
> to prevent upcalls into the python interpreter, triggering garbage
> collection, thread switching, signal handling, or whatever else, for what
> could be a very cheap and early check.
>
> I'm not a C++ programmer by any means, but I think the signature would
> look something like this:
>
> ESet
> Enquire::get_eset(Xapian::termcount maxitems, const RSet & rset, int
> flags,
>                   double k, const ExpandDecider * edecider, const string
> &prefix) const
>

> In python it could be called with a prefix='string' argument.

New description:

 Suggest Enquire.get_eset arguments include 'prefix' that rejects terms
 early that do not begin with the argument value.  My personal use case is
 to prevent upcalls into the python interpreter, triggering garbage
 collection, thread switching, signal handling, or whatever else, for what
 could be a very cheap and early check.

 I'm not a C++ programmer by any means, but I think the signature would
 look something like this:

 {{{
 #!cpp
 ESet
 Enquire::get_eset(Xapian::termcount maxitems, const RSet & rset, int
 flags,
                   double k, const ExpandDecider * edecider, const string
 &prefix) const
 }}}

 In python it could be called with a prefix='string' argument.

--

Comment:

 I think the prefix checking would need to be "has term prefix «foo»"
 rather than a simple string match - otherwise you couldn't usefully use
 this to select only unprefixed terms, which is likely the most commonly
 wanted case.

 An alternative would be to supply a standard !ExpandDecider subclass which
 restricts to a particular prefix.

 Either way it can be done in an upwardly API compatible way, so is
 suitable for 1.2.x.

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



More information about the Xapian-tickets mailing list