This is an automated email from the git hooks/post-receive script. olly pushed a commit to annotated tag upstream/1.2.24.0 in repository libsearch-xapian-perl.
commit 720d9fa7f3a523ef186848d4e7e4b6ba93c4c4b1 Author: Olly Betts <o...@survex.com> Date: Fri Sep 30 15:56:00 2016 +1300 New upstream version 1.2.24.0 --- Changes | 7 +++++++ MANIFEST | 3 ++- META.json | 42 +++++++++++++++++++++++++++++++++++++ META.yml | 39 +++++++++++++++++----------------- Makefile.PL | 7 +++++-- README | 19 ++++++++--------- XS/Enquire.xs | 54 ++++++++++++++---------------------------------- XS/MultiValueSorter.xs | 12 +++++------ Xapian.pm | 2 +- Xapian/Error.pm | 2 +- generate-perl-exceptions | 2 +- t/10query.t | 20 +++++++++++++----- t/parser.t | 26 ++++++++++++++++------- t/search.t | 21 ++++++++++++++----- typemap | 2 ++ 15 files changed, 161 insertions(+), 97 deletions(-) diff --git a/Changes b/Changes index 34b3fff..860b6e3 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,12 @@ Revision history for Perl extension Search::Xapian. +1.2.24.0 Fri Sep 16 01:46:36 UTC 2016 + [Changes contributed by Nick Morrott] + - Fix typo in POD documentation (fixes #730). + [Changes contributed by Olly Betts] + - Allow building against xapian-core 1.4.x as well as xapian-core + 1.2.x. + 1.2.23.0 Mon Mar 28 08:44:59 UTC 2016 [Changes contributed by Olly Betts] - makehtmldocs: Fix inter-class links in generated HTML. diff --git a/MANIFEST b/MANIFEST index f069e52..74487b8 100644 --- a/MANIFEST +++ b/MANIFEST @@ -151,4 +151,5 @@ examples/simpleexpand.pl examples/simpleindex.pl examples/simplematchdecider.pl examples/simplesearch.pl -META.yml Module meta-data (added by MakeMaker) +META.yml Module YAML meta-data (added by MakeMaker) +META.json Module JSON meta-data (added by MakeMaker) diff --git a/META.json b/META.json new file mode 100644 index 0000000..c4e2f9b --- /dev/null +++ b/META.json @@ -0,0 +1,42 @@ +{ + "abstract" : "Perl XS frontend to the Xapian C++ search library.", + "author" : [ + "Alex Bowley <xapian-disc...@lists.xapian.org>" + ], + "dynamic_config" : 1, + "generated_by" : "ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.150010", + "license" : [ + "perl_5" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : "2" + }, + "name" : "Search-Xapian", + "no_index" : { + "directory" : [ + "t", + "inc" + ] + }, + "prereqs" : { + "build" : { + "requires" : { + "Devel::Leak" : "0" + } + }, + "configure" : { + "requires" : { + "ExtUtils::MakeMaker" : "0" + } + }, + "runtime" : { + "requires" : { + "perl" : "5.006000" + } + } + }, + "release_status" : "stable", + "version" : "v1.2.24.0", + "x_serialization_backend" : "JSON::PP version 2.27300" +} diff --git a/META.yml b/META.yml index c73b2e9..f381bd6 100644 --- a/META.yml +++ b/META.yml @@ -1,22 +1,23 @@ ---- #YAML:1.0 -name: Search-Xapian -version: 1.2.23.0 -abstract: Perl XS frontend to the Xapian C++ search library. +--- +abstract: 'Perl XS frontend to the Xapian C++ search library.' author: - - Alex Bowley <xapian-disc...@lists.xapian.org> -license: perl -distribution_type: module -configure_requires: - ExtUtils::MakeMaker: 0 + - 'Alex Bowley <xapian-disc...@lists.xapian.org>' build_requires: - Devel::Leak: 0 -requires: - perl: 5.006000 -no_index: - directory: - - t - - inc -generated_by: ExtUtils::MakeMaker version 6.57_05 + Devel::Leak: '0' +configure_requires: + ExtUtils::MakeMaker: '0' +dynamic_config: 1 +generated_by: 'ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.150010' +license: perl meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: '1.4' +name: Search-Xapian +no_index: + directory: + - t + - inc +requires: + perl: '5.006000' +version: v1.2.24.0 +x_serialization_backend: 'CPAN::Meta::YAML version 0.012' diff --git a/Makefile.PL b/Makefile.PL index 6e36868..b5f429f 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -200,11 +200,14 @@ close F; my ($BASEVERSION) = $VERSION =~ /^([0-9]+\.[0-9]+\.[0-9]+)/; if ($xver !~ /^\Q$BASEVERSION\E(?:_(?:svn|git)[0-9]+)?$/) { - # We definitely need Xapian 1.2.x. - my $no_chance = ($xver !~ /^1\.2\./); + # We definitely need Xapian 1.2.x or 1.4.x. + my $no_chance = ($xver !~ /^1\.[24]\./); my $msg; if ($no_chance) { $msg = "Xapian version $xver is incompatible with Search::Xapian $VERSION\n"; + } elsif ($BASEVERSION =~ /^1\.2\./ && $xver =~ /^1\.4\./) { + # Search::Xapian 1.2.x and xapian-core 1.4.y should work together + # (for x >= 24). } else { $msg = "Xapian version $xver may be incompatible with Search::Xapian $VERSION\n"; } diff --git a/README b/README index b892a0a..79cb18f 100644 --- a/README +++ b/README @@ -1,16 +1,14 @@ -Search::Xapian version 1.2.23.0 +Search::Xapian version 1.2.24.0 =============================== This is Search::Xapian, a Perl XS interface to the Xapian C++ search library. -In the next release series (Xapian 1.4.x) these hand-coded XS wrappers will -be replaced with a version generated with SWIG. This means that new C++ -API features can be wrapped for Perl more quickly and easily than currently. - -These new wrappers attempt to be compatible with the current ones, but we -encourage you to try them with your code and report any incompatibilities so -we can attempt to address them. You can find them in the Xapian 1.3.x -development release series. +Xapian 1.4.x aims to replace these hand-coded XS wrappers with wrappers +generated with SWIG, which will allow new C++ API features to be wrapped for +Perl more quickly and easily than currently. These aren't currently quite +ready, and because of this (and also to assist people with migration) the +XS bindings can also be compiled against xapian-core 1.4.x, and aim to +present the same Perl API as when compiled against xapian-core 1.2.x. INSTALLATION @@ -46,7 +44,8 @@ Perl script (i.e. when "use threads;" is in use), Perl >= 5.8.7 is required. This module requires these other modules and libraries: The Xapian C++ search library, which can be downloaded by following - the instructions on https://xapian.org/ + the instructions on https://xapian.org/ - versions 1.2.x and 1.4.x + are supported by Search::Xapian 1.2.24.0 and later. DOCUMENTATION diff --git a/XS/Enquire.xs b/XS/Enquire.xs index c83f711..476c4ff 100644 --- a/XS/Enquire.xs +++ b/XS/Enquire.xs @@ -90,103 +90,79 @@ Enquire::set_sort_by_relevance() THIS->set_sort_by_relevance(); void -Enquire::set_sort_by_value(sort_key, ascending = NO_INIT) +Enquire::set_sort_by_value(sort_key, ascending = true) valueno sort_key bool ascending CODE: // Clear reference to any currently set sorter object. XAPIAN_PERL_REF(Enquire, THIS, sorter, NULL); try { - if (items == 3) { /* items includes the hidden this pointer */ - THIS->set_sort_by_value(sort_key, ascending); - } else { - THIS->set_sort_by_value(sort_key); - } + THIS->set_sort_by_value(sort_key, ascending); } catch (...) { handle_exception(); } void -Enquire::set_sort_by_value_then_relevance(sort_key, ascending = NO_INIT) +Enquire::set_sort_by_value_then_relevance(sort_key, ascending = true) valueno sort_key bool ascending CODE: // Clear reference to any currently set sorter object. XAPIAN_PERL_REF(Enquire, THIS, sorter, NULL); try { - if (items == 3) { /* items includes the hidden this pointer */ - THIS->set_sort_by_value_then_relevance(sort_key, ascending); - } else { - THIS->set_sort_by_value_then_relevance(sort_key); - } + THIS->set_sort_by_value_then_relevance(sort_key, ascending); } catch (...) { handle_exception(); } void -Enquire::set_sort_by_relevance_then_value(sort_key, ascending = NO_INIT) +Enquire::set_sort_by_relevance_then_value(sort_key, ascending = true) valueno sort_key bool ascending CODE: // Clear reference to any currently set sorter object. XAPIAN_PERL_REF(Enquire, THIS, sorter, NULL); try { - if (items == 3) { /* items includes the hidden this pointer */ - THIS->set_sort_by_relevance_then_value(sort_key, ascending); - } else { - THIS->set_sort_by_relevance_then_value(sort_key); - } + THIS->set_sort_by_relevance_then_value(sort_key, ascending); } catch (...) { handle_exception(); } void -Enquire::set_sort_by_key(sorter, ascending = NO_INIT) - MultiValueSorter * sorter +Enquire::set_sort_by_key(sorter, ascending = true) + MultiValueKeyMaker * sorter bool ascending CODE: // Keep a reference to the currently set object. XAPIAN_PERL_REF(Enquire, THIS, sorter, ST(1)); try { - if (items == 3) { /* items includes the hidden this pointer */ - THIS->set_sort_by_key(sorter, ascending); - } else { - THIS->set_sort_by_key(sorter); - } + THIS->set_sort_by_key(sorter, ascending); } catch (...) { handle_exception(); } void -Enquire::set_sort_by_key_then_relevance(sorter, ascending = NO_INIT) - MultiValueSorter * sorter +Enquire::set_sort_by_key_then_relevance(sorter, ascending = true) + MultiValueKeyMaker * sorter bool ascending CODE: // Keep a reference to the currently set object. XAPIAN_PERL_REF(Enquire, THIS, sorter, ST(1)); try { - if (items == 3) { /* items includes the hidden this pointer */ - THIS->set_sort_by_key_then_relevance(sorter, ascending); - } else { - THIS->set_sort_by_key_then_relevance(sorter); - } + THIS->set_sort_by_key_then_relevance(sorter, ascending); } catch (...) { handle_exception(); } void -Enquire::set_sort_by_relevance_then_key(sorter, ascending = NO_INIT) - MultiValueSorter * sorter +Enquire::set_sort_by_relevance_then_key(sorter, ascending = true) + MultiValueKeyMaker * sorter bool ascending CODE: // Keep a reference to the currently set object. XAPIAN_PERL_REF(Enquire, THIS, sorter, ST(1)); try { - if (items == 3) { /* items includes the hidden this pointer */ - THIS->set_sort_by_relevance_then_key(sorter, ascending); - } else { - THIS->set_sort_by_relevance_then_key(sorter); - } + THIS->set_sort_by_relevance_then_key(sorter, ascending); } catch (...) { handle_exception(); } diff --git a/XS/MultiValueSorter.xs b/XS/MultiValueSorter.xs index 3b9dab2..6971639 100644 --- a/XS/MultiValueSorter.xs +++ b/XS/MultiValueSorter.xs @@ -2,21 +2,21 @@ MODULE = Search::Xapian PACKAGE = Search::Xapian::MultiValueSorter PROTOTYPES: ENABLE -MultiValueSorter * +MultiValueKeyMaker * new0() CODE: - RETVAL = new MultiValueSorter(); + RETVAL = new MultiValueKeyMaker(); OUTPUT: RETVAL void -MultiValueSorter::add(valueno valno, bool forward = NO_INIT) +MultiValueKeyMaker::add(valueno valno, bool forward = NO_INIT) CODE: if (items == 3) { /* items includes the hidden this pointer */ - THIS->add(valno, forward); + THIS->add_value(valno, !forward); } else { - THIS->add(valno); + THIS->add_value(valno); } void -MultiValueSorter::DESTROY() +MultiValueKeyMaker::DESTROY() diff --git a/Xapian.pm b/Xapian.pm index 9d6efa9..aa8dc40 100644 --- a/Xapian.pm +++ b/Xapian.pm @@ -4,7 +4,7 @@ use 5.006; use strict; use warnings; -our $VERSION = '1.2.23.0'; +our $VERSION = '1.2.24.0'; use Exporter 'import'; diff --git a/Xapian/Error.pm b/Xapian/Error.pm index 2043ae9..57f62ea 100644 --- a/Xapian/Error.pm +++ b/Xapian/Error.pm @@ -16,7 +16,7 @@ All exception objects have the following methods =head2 get_msg -Returns a string with a descriptive error message, useful for outputing +Returns a string with a descriptive error message, useful for outputting =head2 get_type diff --git a/generate-perl-exceptions b/generate-perl-exceptions index 57257d4..d19be7c 100644 --- a/generate-perl-exceptions +++ b/generate-perl-exceptions @@ -55,7 +55,7 @@ All exception objects have the following methods =head2 get_msg -Returns a string with a descriptive error message, useful for outputing +Returns a string with a descriptive error message, useful for outputting =head2 get_type diff --git a/t/10query.t b/t/10query.t index 57f013b..f1237df 100644 --- a/t/10query.t +++ b/t/10query.t @@ -13,22 +13,32 @@ ok(1); # If we made it this far, we're ok. ######################### +# Adjust query description from 1.4 to match. +sub qd { + local $_ = (shift @_)->get_description(); + if (substr($_, 0, 1) eq 'Q') { + s/\@([0-9]+)/:(pos=$1)/g; + $_ = "Xapian::$_"; + } + return $_; +} + my $query = Search::Xapian::Query->new( OP_AND, Search::Xapian::Query->new( "foo" ), "bar" ); ok(defined $query, "AND query created"); -is($query->get_description, 'Xapian::Query((foo AND bar))', "AND query contains foo part"); +is(qd($query), 'Xapian::Query((foo AND bar))', "AND query contains foo part"); $query = Search::Xapian::Query::MatchAll; -is("$query", 'Xapian::Query(<alldocuments>)'); +is(qd($query), 'Xapian::Query(<alldocuments>)'); $query = Search::Xapian::Query->new(""); -is("$query", 'Xapian::Query(<alldocuments>)'); +is(qd($query), 'Xapian::Query(<alldocuments>)'); $query = Search::Xapian::Query::MatchNothing; -is("$query", 'Xapian::Query()'); +is(qd($query), 'Xapian::Query()'); $query = Search::Xapian::Query->new(); -is("$query", 'Xapian::Query()'); +is(qd($query), 'Xapian::Query()'); eval { Search::Xapian::Query->new("hello", 1, 2, 3, 4); diff --git a/t/parser.t b/t/parser.t index 419a65f..6b5aabb 100644 --- a/t/parser.t +++ b/t/parser.t @@ -16,6 +16,18 @@ ok(1); # If we made it this far, we're ok. # Insert your test code below, the Test module is use()ed here so read # its man page ( perldoc Test ) for help writing this test script. +# Adjust query description from 1.4 to match. +sub qd { + local $_ = (shift @_)->get_description(); + if (substr($_, 0, 1) eq 'Q') { + s/\@([0-9]+)/:(pos=$1)/g; + s/\\x([0-9a-f]{2})/chr(hex($1))/ge; + s/^Query\(0 \* VALUE_RANGE/Query(VALUE_RANGE/; + $_ = "Xapian::$_"; + } + return $_; +} + # first create database dir, if it doesn't exist; my $db_dir = 'testdb'; @@ -32,10 +44,10 @@ $qp->set_default_op( OP_AND ); my $query; ok( $query = $qp->parse_query( 'one or two', FLAG_BOOLEAN|FLAG_BOOLEAN_ANY_CASE|FLAG_SPELLING_CORRECTION ) ); ok( not $qp->get_corrected_query_string()); -ok( $query->get_description(), "Xapian::Query((one:(pos=1) OR two:(pos=2)))" ); +ok( qd($query), "Xapian::Query((one:(pos=1) OR two:(pos=2)))" ); ok( $query = $qp->parse_query( 'one OR (two AND three)' ) ); -ok( $query->get_description(), "Xapian::Query((one:(pos=1) OR (two:(pos=2) AND three:(pos=3))))" ); +ok( qd($query), "Xapian::Query((one:(pos=1) OR (two:(pos=2) AND three:(pos=3))))" ); ok( my $enq = $database->enquire( $query ) ); @@ -74,7 +86,7 @@ my $pair; foreach $pair ( [ 'a..b', 'VALUE_RANGE 1 a b' ], [ '$50..100', 'VALUE_RANGE 1 $50 100' ], - [ '$50..$100', 'VALUE_RANGE 1 $50 $100' ], + [ '$50..$99', 'VALUE_RANGE 1 $50 $99' ], [ '02/03/1979..10/12/1980', 'VALUE_RANGE 1 02/03/1979 10/12/1980' ], [ 'a..b hello', '(hello:(pos=1) FILTER VALUE_RANGE 1 a b)' ], [ 'hello a..b', '(hello:(pos=1) FILTER VALUE_RANGE 1 a b)' ], @@ -87,7 +99,7 @@ foreach $pair ( ) { my ($str, $res) = @{$pair}; my $query = $qp->parse_query($str); - ok( $query->get_description(), "Xapian::Query($res)" ); + ok( qd($query), "Xapian::Query($res)" ); } $qp = new Search::Xapian::QueryParser(); @@ -117,7 +129,7 @@ foreach $pair ( [ '12..42kg', "VALUE_RANGE 5 \xae \xb5@" ], [ '12kg..42kg', "VALUE_RANGE 5 \xae \xb5@" ], [ '12kg..42', 'VALUE_RANGE 3 12kg 42' ], - [ '10..$20', 'VALUE_RANGE 3 10 $20' ], + [ '!10..$20', 'VALUE_RANGE 3 !10 $20' ], [ '1999-03-12..2020-12-30', 'VALUE_RANGE 1 19990312 20201230' ], [ '1999/03/12..2020/12/30', 'VALUE_RANGE 1 19990312 20201230' ], [ '1999.03.12..2020.12.30', 'VALUE_RANGE 1 19990312 20201230' ], @@ -129,7 +141,7 @@ foreach $pair ( ) { my ($str, $res) = @{$pair}; my $query = $qp->parse_query($str); - ok( $query->get_description(), "Xapian::Query($res)" ); + ok( qd($query), "Xapian::Query($res)" ); } $qp = new Search::Xapian::QueryParser(); @@ -146,7 +158,7 @@ foreach $pair ( ) { my ($str, $res) = @{$pair}; my $query = $qp->parse_query($str); - ok( $query->get_description(), "Xapian::Query($res)" ); + ok( qd($query), "Xapian::Query($res)" ); } # Regression test for Search::Xapian bug fixed in 1.0.5.0. In 1.0.0.0-1.0.4.0 diff --git a/t/search.t b/t/search.t index a78cee6..bef6847 100644 --- a/t/search.t +++ b/t/search.t @@ -18,6 +18,17 @@ use Search::Xapian qw(:ops); # None of the following tests can be expected to succeed without first # creating a test database in the directory testdb. +# Adjust query description from 1.4 to match. +sub qd { + local $_ = (shift @_)->get_description(); + if (substr($_, 0, 1) eq 'Q') { + s/\@([0-9]+)/:(pos=$1)/g; + s/^Query\(0 \* VALUE_RANGE/Query(VALUE_RANGE/; + $_ = "Xapian::$_"; + } + return $_; +} + my $db; ok( $db = Search::Xapian::Database->new( 'testdb' ), "test db opened ok" ); @@ -27,14 +38,14 @@ ok( $enq = $db->enquire(), "db enquirable" ); my @subqueries; my $query; ok( $subqueries[0] = Search::Xapian::Query->new( 'test' ), "one-term queries ok" ); -is( $subqueries[0]->get_description, "Xapian::Query(test)", "query parsed correctly" ); +is( qd($subqueries[0]), "Xapian::Query(test)", "query parsed correctly" ); # tests 5-14 foreach my $op (OP_OR, OP_AND, OP_NEAR, OP_PHRASE) { ok( $query = Search::Xapian::Query->new( $op, @subqueries ), "$Search::Xapian::OP_NAMES[$op] works with 1 object" ); ok( $query = Search::Xapian::Query->new( $op, 'help' ), "$Search::Xapian::OP_NAMES[$op] works with 1 term" ); } -is( $query->get_description, "Xapian::Query(help)", "query parsed correctly" ); +is( qd($query), "Xapian::Query(help)", "query parsed correctly" ); # tests 15-41 $subqueries[1] = Search::Xapian::Query->new( 'help' ); @@ -44,7 +55,7 @@ foreach my $op (OP_OR, OP_AND, OP_NEAR, OP_PHRASE, ok( $query = Search::Xapian::Query->new( $op, $subqueries[0], 'test'), "$Search::Xapian::OP_NAMES[$op] works with an object and a term" ); ok( $query = Search::Xapian::Query->new( $op, 'test', 'help'), "$Search::Xapian::OP_NAMES[$op] works with 2 terms" ); } -is( $query->get_description, "Xapian::Query((test ELITE_SET 10 help))", "query parsed correctly" ); +is( qd($query), "Xapian::Query((test ELITE_SET 10 help))", "query parsed correctly" ); # tests 42-... $subqueries[2] = Search::Xapian::Query->new( 'one' ); @@ -52,7 +63,7 @@ foreach my $op (OP_OR, OP_AND, OP_NEAR, OP_PHRASE ) { ok( $query = Search::Xapian::Query->new( $op, @subqueries ), "$Search::Xapian::OP_NAMES[$op] works with 3 objects" ); ok( $query = Search::Xapian::Query->new( $op, 'test', 'help', 'one' ), "$Search::Xapian::OP_NAMES[$op] works with 3 terms" ); } -is( $query->get_description, "Xapian::Query((test PHRASE 3 help PHRASE 3 one))", "query parsed correctly" ); +is( qd($query), "Xapian::Query((test PHRASE 3 help PHRASE 3 one))", "query parsed correctly" ); ok( $enq = $db->enquire( $query ), "db queries return ok" ); ok( $enq = $db->enquire( OP_OR, 'test', 'help' ), "in-line db queries return ok" ); @@ -185,6 +196,6 @@ ok( ++$alltermit == $db->allterms_end('t') ); # Check that non-string scalars get coerced. my $numberquery = Search::Xapian::Query->new( OP_OR, (12, "34", .5) ); -is( $numberquery->get_description(), "Xapian::Query((12 OR 34 OR 0.5))" ); +is( qd($numberquery), "Xapian::Query((12 OR 34 OR 0.5))" ); 1; diff --git a/typemap b/typemap index 77d8e6d..497d848 100644 --- a/typemap +++ b/typemap @@ -62,6 +62,8 @@ StringValueRangeProcessor * O_OBJECT MultiValueSorter O_SORTER MultiValueSorter * O_SORTER +MultiValueKeyMaker O_SORTER +MultiValueKeyMaker * O_SORTER MatchSpy O_MATCHSPY MatchSpy * O_MATCHSPY -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libsearch-xapian-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits