Opened 15 years ago

Closed 12 years ago

Last modified 12 years ago

#467 closed enhancement (fixed)

Add standard ExpandDecider subclass to restrict to terms with a particular prefix

Reported by: Michel Pelletier Owned by: Olly Betts
Priority: normal Milestone: 1.3.1
Component: Library API Version:
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: All

Description (last modified by Olly Betts)

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.

Change History (7)

comment:1 by Olly Betts, 14 years ago

Description: modified (diff)
Milestone: 1.2.x

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.

comment:2 by Dan, 14 years ago

I think this could be wrapped into a standard ExpandDecider class that the API provides.

comment:3 by Michel Pelletier, 14 years ago

Based on our conversation 5 minutes ago, I agree. :)

comment:4 by Olly Betts, 14 years ago

Summary: Extend get_eset() signature to include optional prefix argumentAdd standard ExpandDecider subclass to restrict to terms with a particular prefix

Retitling to reflect the preferred approach.

comment:5 by Olly Betts, 12 years ago

Milestone: 1.2.x1.3.x

1.3.x material now.

comment:6 by Olly Betts, 12 years ago

Resolution: fixed
Status: newclosed

Fixed in trunk r17144 and r17145 thanks to a patch from jiangwen jiang.

comment:7 by Olly Betts, 12 years ago

Milestone: 1.3.x1.3.1
Note: See TracTickets for help on using tickets.