Opened 12 years ago

Closed 12 years ago

#607 closed defect (fixed)

Handle second and third argument to Xapian::StringValueRangeProcessor new() in Perl bindings

Reported by: Adam Sjøgren Owned by: Olly Betts
Priority: normal Milestone: 1.2.13
Component: Search::Xapian Version: 1.2.12
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: All

Description

Search::Xapian lacks support for the three argument version of new for Xapian::StringValueRangeProcessor.

The attached patch tries to add support, and updates the documentation. We haven't had time to add to the test suite. The patch can be included under GPLv2 or later.

Attachments (2)

0001-Add-support-for-3-arg-version-of-StringValueRangePro.patch (2.0 KB ) - added by Adam Sjøgren 12 years ago.
0001-Add-support-for-2-and-3-arg-versions-of-StringValueR.patch (3.5 KB ) - added by Adam Sjøgren 12 years ago.
Updated patch

Download all attachments as: .zip

Change History (10)

comment:1 by Olly Betts, 12 years ago

Milestone: 1.2.13
Version: 1.2.12

We ask for a dual licence on contributed patches, not just GPLv2+:

http://trac.xapian.org/browser/trunk/xapian-core/HACKING#L1231

In this particular case, the XS changes would only be relevant for 1.2.x as trunk has SWIG-based Perl bindings (which should wrap these optional arguments already), but the documentation change and any testsuite changes would likely be useful for trunk too.

Looking at the patch, I think passing 2 arguments should be valid too, not just 1 or 3.

A simple feature test to make sure the Perl wrapper does now accept 3 (or 2) arguments and still accepts 1 would be good, and would also help to ensure this is compatible with trunk. I can probably write one if necessary, though that's likely to delay getting this applied - a corresponding testsuite change would be very welcome.

comment:2 by Adam Sjøgren, 12 years ago

License: ah, sorry, I misread and thought either was enough.

Trunk: I couldn't find search-xapian in trunk, that is why the patch is against 1.2.

2 arguments: Ok, I'm not proficient enough in C++ to tell.

Thanks for the feedback.

comment:3 by Olly Betts, 12 years ago

On trunk the search-xapian module has been removed, and there's a SWIG-generated set of bindings (also called Search::Xapian) in xapian-bindings/perl. The big benefit of using SWIG is that wrapping of new features happens automatically in many cases, so you shouldn't end up hitting missing wrappers like this one as of 1.4.0.

The SWIG-generated wrappers are mostly compatible with those in search-xapian, though there are a few differences. I've been keeping the testsuites aligned as far as possible, which helps to minimise the differences.

comment:4 by Olly Betts, 12 years ago

Oh, and I tried to make it clearer that we're after a dual-licence in r16835.

by Adam Sjøgren, 12 years ago

Updated patch

comment:5 by Adam Sjøgren, 12 years ago

I have uploaded a new patch.

It now handles the 2 argument case, and adds two tests to parser.t (testing 2 and 3 argument calls; the existing tests cover the 1 argument case, as far as I can tell).

The content of the patch is contributed to the Xapian project as dual-licensed under GPLv2 and later, and MIT/X.

comment:6 by Olly Betts, 12 years ago

Thanks, looks good from a quick scan through. Thanks for the update.

Actually, since 1.1.2, StringValueRangeProcessor handles the prefix/suffix and DateValueRangeProcessor and NumberValueRangeProcessor are now subclasses of it (previously, all three were direct subclasses of ValueRangeProcessor, and only NumberValueRangeProcessor had the prefix and suffix support, which is what the "valueranges" document describes).

So I've updated that document to describe the prefix/suffix stuff once for all the classes instead, and committed that change to trunk as r16836.

Still to do: r16836 needs backporting to the 1.2 branch, the rest of the patch needs applying to the 1.2 branch, and the new tests need to be added to the SWIG-based perl bindings on trunk.

comment:7 by Olly Betts, 12 years ago

Committed rest of patch to 1.2 branch as r16837.

comment:8 by Olly Betts, 12 years ago

Resolution: fixed
Status: newclosed

New tests added to SWIG-based perl bindings on trunk in r16842 (and they pass, which is good).

Doc improvement in xapian-core backported for 1.2.13 in r16843.

Note: See TracTickets for help on using tickets.