r18191 - in /trunk/libsearch-xapian-perl: Changes META.yml Makefile.PL README XS/Enquire.xs XS/Query.xs XS/WritableDatabase.xs Xapian.pm Xapian.xs Xapian/Enquire.pm Xapian/Query.pm debian/changelog t/index.t t/search.t t/sorter.t t/valuerange.t
gregoa-guest at users.alioth.debian.org
gregoa-guest at users.alioth.debian.org
Mon Mar 31 15:39:20 UTC 2008
Author: gregoa-guest
Date: Mon Mar 31 15:39:19 2008
New Revision: 18191
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=18191
Log:
New upstream release.
Modified:
trunk/libsearch-xapian-perl/Changes
trunk/libsearch-xapian-perl/META.yml
trunk/libsearch-xapian-perl/Makefile.PL
trunk/libsearch-xapian-perl/README
trunk/libsearch-xapian-perl/XS/Enquire.xs
trunk/libsearch-xapian-perl/XS/Query.xs
trunk/libsearch-xapian-perl/XS/WritableDatabase.xs
trunk/libsearch-xapian-perl/Xapian.pm
trunk/libsearch-xapian-perl/Xapian.xs
trunk/libsearch-xapian-perl/Xapian/Enquire.pm
trunk/libsearch-xapian-perl/Xapian/Query.pm
trunk/libsearch-xapian-perl/debian/changelog
trunk/libsearch-xapian-perl/t/index.t
trunk/libsearch-xapian-perl/t/search.t
trunk/libsearch-xapian-perl/t/sorter.t
trunk/libsearch-xapian-perl/t/valuerange.t
Modified: trunk/libsearch-xapian-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/Changes?rev=18191&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/Changes (original)
+++ trunk/libsearch-xapian-perl/Changes Mon Mar 31 15:39:19 2008
@@ -1,4 +1,31 @@
Revision history for Perl extension Search::Xapian.
+
+1.0.6.0 ???
+ [Changes contributed by Olly Betts]
+ - If the Search::Xapian and xapian-config versions don't match, and
+ $ENV{AUTOMATED_TESTING} is true, then we need to unlink Makefile as
+ well as exiting with status 0.
+ - Mention QueryParser flags in POD: FLAG_SPELLING_CORRECTION,
+ FLAG_SYNONYM, FLAG_AUTO_SYNONYMS, and FLAG_AUTO_MULTIWORD_SYNONYMS.
+ - Removed no-op method Enquire::register_match_decider() which is now
+ deprecated in C++. It doesn't do anything, and never has, so if
+ you were calling it, you can just remove the call!
+ - Improve POD for Enquire::get_eset().
+ - Increment the reference counts of Sorter objects passed to methods
+ of Enquire. This means we'll leak them, but that's better than
+ having them garbage collected while the C++ code is still using them.
+ This will be fixed properly in a future release.
+ - You can now construct a Query from a mixed list of Query objects and
+ strings (previously the list had to be all Query objects or all
+ strings).
+ - Don't accept values with a leading '-' or '+' for OP_* constants -
+ users should be using the defined constants for these which are all
+ positive without an explicit '+'.
+ - Wrap OP_SCALE_WEIGHT, OP_VALUE_GE, OP_VALUE_LE, and the corresponding
+ Query constructor overloads.
+ [Changes contributed by Matthew Somerville]
+ - Wrap optional prefix argument to WritableDatabase::allterms_begin()
+ and WritableDatabase::allterms_end().
1.0.5.0 Wed Jan 02 01:07:28 GMT 2008
[Changes contributed by Olly Betts]
@@ -25,13 +52,13 @@
const char * - it stopped throwing const char * in Xapian 1.0.0
(bug#221).
- Wrap TermGenerator methods: set_database() and set_flags().
- [Changes contributed by Rusty Conover]
+ [Changes contributed by Rusty Conover]
- Wrap QueryParser flags: FLAG_SPELLING_CORRECTION, FLAG_SYNONYM,
FLAG_AUTO_SYNONYMS, and FLAG_AUTO_MULTIWORD_SYNONYMS.
- Wrap WritableDatabase methods: add_synonym(), remove_synonym(), and
clear_synonyms().
- Wrap TermGenerator::FLAG_SPELLING and TermGenerator::set_database().
-
+
1.0.4.0 Wed Oct 31 23:18:02 GMT 2007
[Changes contributed by Olly Betts]
- Add all the POD pages to the "see also" on the main POD page.
@@ -94,7 +121,7 @@
[Changes contributed by Olly Betts]
- Wrap new TermGenerator class.
- Wrap new QueryParser flags FLAG_PURE_NOT and FLAG_PARTIAL.
- - Wrap new Query op OP_VALUE_RANGE and associated constructor.
+ - Wrap new Query op OP_VALUE_RANGE and associated constructor.
- Wrap ValueRangeProcessor and subclasses, and
QueryParser::add_valuerangeprocessor().
- Removed wrappers for deprecated features which have now been removed
@@ -120,7 +147,7 @@
Enquire::matches()
- Add tests for check_at_least and rset parameters of
Enquire::get_mset()
- - Avoid warning from MakeMaker when generating Makefile for linking
+ - Avoid warning from MakeMaker when generating Makefile for linking
against an uninstalled xapian-core tree.
- Correct several errors in the pod documentation for
Search::Xapian::PositionIterator.
Modified: trunk/libsearch-xapian-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/META.yml?rev=18191&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/META.yml (original)
+++ trunk/libsearch-xapian-perl/META.yml Mon Mar 31 15:39:19 2008
@@ -1,7 +1,7 @@
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Search-Xapian
-version: 1.0.5.0
+version: 1.0.6.0
version_from: Xapian.pm
installdirs: site
requires:
Modified: trunk/libsearch-xapian-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/Makefile.PL?rev=18191&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/Makefile.PL (original)
+++ trunk/libsearch-xapian-perl/Makefile.PL Mon Mar 31 15:39:19 2008
@@ -132,6 +132,10 @@
# Don't let automated testers continue, as we don't want bogus failure
# reports due to builds with incompatible versions.
print $msg;
+ # Remove Makefile since "exit status 0 without generating Makefile"
+ # is taken to indicate "can't build because of missing dependencies"
+ # by CPAN test building scripts.
+ unlink "Makefile";
exit 0;
}
warn "Warning: $msg";
Modified: trunk/libsearch-xapian-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/README?rev=18191&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/README (original)
+++ trunk/libsearch-xapian-perl/README Mon Mar 31 15:39:19 2008
@@ -1,4 +1,4 @@
-Search::Xapian version 1.0.5.0
+Search::Xapian version 1.0.6.0
==============================
This is Search::Xapian, a Perl XS frontend to the Xapian C++ search library.
Modified: trunk/libsearch-xapian-perl/XS/Enquire.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/XS/Enquire.xs?rev=18191&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/XS/Enquire.xs (original)
+++ trunk/libsearch-xapian-perl/XS/Enquire.xs Mon Mar 31 15:39:19 2008
@@ -94,6 +94,9 @@
MultiValueSorter * sorter
bool ascending
CODE:
+ // FIXME: no corresponding SvREFCNT_dec(), but a leak seems better than
+ // a SEGV!
+ SvREFCNT_inc(ST(1));
if (items == 3) { /* items includes the hidden this pointer */
THIS->set_sort_by_key(sorter, ascending);
} else {
@@ -105,6 +108,9 @@
MultiValueSorter * sorter
bool ascending
CODE:
+ // FIXME: no corresponding SvREFCNT_dec(), but a leak seems better than
+ // a SEGV!
+ SvREFCNT_inc(ST(1));
if (items == 3) { /* items includes the hidden this pointer */
THIS->set_sort_by_key_then_relevance(sorter, ascending);
} else {
@@ -116,6 +122,9 @@
MultiValueSorter * sorter
bool ascending
CODE:
+ // FIXME: no corresponding SvREFCNT_dec(), but a leak seems better than
+ // a SEGV!
+ SvREFCNT_inc(ST(1));
if (items == 3) { /* items includes the hidden this pointer */
THIS->set_sort_by_relevance_then_key(sorter, ascending);
} else {
@@ -204,13 +213,6 @@
RETVAL
void
-Enquire::register_match_decider(name, mdecider)
- string name
- MatchDecider * mdecider
- CODE:
- THIS->register_match_decider(name, mdecider);
-
-void
Enquire::set_weighting_scheme(weight_)
Weight * weight_
CODE:
Modified: trunk/libsearch-xapian-perl/XS/Query.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/XS/Query.xs?rev=18191&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/XS/Query.xs (original)
+++ trunk/libsearch-xapian-perl/XS/Query.xs Mon Mar 31 15:39:19 2008
@@ -21,20 +21,19 @@
RETVAL
Query *
-new2sv(op, subq)
- int op
- string subq
+new3scale(int op, Query * query, double factor)
CODE:
- RETVAL = new Query( (Query::op) op, subq );
+ RETVAL = new Query( (Query::op) op, *query, factor );
OUTPUT:
RETVAL
Query *
-new2obj(op, subq)
+new3range(op, valno, limit)
int op
- Query * subq
+ valueno valno
+ string limit
CODE:
- RETVAL = new Query( (Query::op) op, *subq );
+ RETVAL = new Query( (Query::op) op, valno, limit );
OUTPUT:
RETVAL
@@ -50,47 +49,27 @@
RETVAL
Query *
-newXsv(op, ...)
- int op
- PREINIT:
- vector<string> terms;
+newN(int op_, ...)
CODE:
- terms.reserve(items);
- for( int i = 1; i <= items; i++ ) {
- SV *sv = ST (i);
- if( SvOK(sv) && SvPOK(sv) ) {
- STRLEN len;
- const char * ptr = SvPV(sv, len);
- terms.push_back(string(ptr, len));
+ Query::op op = (Query::op)op_;
+ try {
+ vector<Query> queries;
+ queries.reserve(items - 1);
+ for( int i = 1; i < items; i++ ) {
+ SV *sv = ST (i);
+ if (sv_isa(sv, "Search::Xapian::Query")) {
+ Query *query = (Query*) SvIV((SV*) SvRV(sv));
+ queries.push_back(*query);
+ } else if ( SvOK(sv) && SvPOK(sv) ) {
+ STRLEN len;
+ const char * ptr = SvPV(sv, len);
+ queries.push_back(Query(string(ptr, len)));
+ } else {
+ croak( "USAGE: Search::Xapian::Query->new(OP, @TERMS_OR_QUERY_OBJECTS)" );
+ }
}
- }
- try {
- RETVAL = new Query( (Query::op) op, terms.begin(), terms.end() );
- }
- catch (const Error &error) {
- croak( "Exception: %s", error.get_msg().c_str() );
- }
- OUTPUT:
- RETVAL
-
-Query *
-newXobj(op, ...)
- int op
- PREINIT:
- vector<Query> queries;
- CODE:
- queries.reserve(items);
- for( int i = 1; i <= items; i++ ) {
- SV *sv = ST (i);
- if( sv_isobject(sv) ) {
- Query *query = (Query*) SvIV((SV*) SvRV(sv));
- queries.push_back(*query);
- }
- }
- try {
- RETVAL = new Query( (Query::op) op, queries.begin(), queries.end() );
- }
- catch (const Error &error) {
+ RETVAL = new Query(op, queries.begin(), queries.end());
+ } catch (const Error &error) {
croak( "Exception: %s", error.get_msg().c_str() );
}
OUTPUT:
Modified: trunk/libsearch-xapian-perl/XS/WritableDatabase.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/XS/WritableDatabase.xs?rev=18191&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/XS/WritableDatabase.xs (original)
+++ trunk/libsearch-xapian-perl/XS/WritableDatabase.xs Mon Mar 31 15:39:19 2008
@@ -217,10 +217,11 @@
RETVAL
TermIterator *
-WritableDatabase::allterms_begin()
- CODE:
- try {
- RETVAL = new TermIterator(THIS->allterms_begin());
+WritableDatabase::allterms_begin(prefix = "")
+ string prefix
+ CODE:
+ try {
+ RETVAL = new TermIterator(THIS->allterms_begin(prefix));
}
catch (const Error &error) {
croak( "Exception: %s", error.get_msg().c_str() );
@@ -229,10 +230,11 @@
RETVAL
TermIterator *
-WritableDatabase::allterms_end()
- CODE:
- try {
- RETVAL = new TermIterator(THIS->allterms_end());
+WritableDatabase::allterms_end(prefix = "")
+ string prefix
+ CODE:
+ try {
+ RETVAL = new TermIterator(THIS->allterms_end(prefix));
}
catch (const Error &error) {
croak( "Exception: %s", error.get_msg().c_str() );
Modified: trunk/libsearch-xapian-perl/Xapian.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/Xapian.pm?rev=18191&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/Xapian.pm (original)
+++ trunk/libsearch-xapian-perl/Xapian.pm Mon Mar 31 15:39:19 2008
@@ -4,7 +4,7 @@
use strict;
use warnings;
-our $VERSION = '1.0.5.0';
+our $VERSION = '1.0.6.0';
use Exporter 'import';
@@ -37,7 +37,7 @@
our @ISA = qw(DynaLoader);
-# Items to export into callers namespace by default. Note: do not export
+# Items to export into caller's namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
@@ -55,7 +55,10 @@
OP_NEAR
OP_PHRASE
OP_VALUE_RANGE
+ OP_SCALE_WEIGHT
OP_ELITE_SET
+ OP_VALUE_GE
+ OP_VALUE_LE
) ],
'db' => [ qw(
DB_OPEN
@@ -287,6 +290,14 @@
whitespace, to produce more stable results from interactive
searches.
+=item FLAG_SPELLING_CORRECTION
+
+=item FLAG_SYNONYM
+
+=item FLAG_AUTO_SYNONYMS
+
+=item FLAG_AUTO_MULTIWORD_SYNONYMS
+
=back
=head1 :qpstem
@@ -303,8 +314,8 @@
=item STEM_SOME
-Stem some terms, in a manner compatible with Omega (capitalised words aren't
-stemmed, and get an 'R' prefix).
+Stem some terms, in a manner compatible with Omega (capitalised words and those
+in phrases aren't stemmed).
=back
@@ -390,6 +401,7 @@
L<Search::Xapian::Database>,
L<Search::Xapian::Document>,
L<Search::Xapian::Enquire>,
+L<Search::Xapian::MultiValueSorter>,
L<Search::Xapian::PositionIterator>,
L<Search::Xapian::PostingIterator>,
L<Search::Xapian::QueryParser>,
Modified: trunk/libsearch-xapian-perl/Xapian.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/Xapian.xs?rev=18191&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/Xapian.xs (original)
+++ trunk/libsearch-xapian-perl/Xapian.xs Mon Mar 31 15:39:19 2008
@@ -156,7 +156,10 @@
ENUM_CONST(OP_NEAR, Query::OP_NEAR);
ENUM_CONST(OP_PHRASE, Query::OP_PHRASE);
ENUM_CONST(OP_VALUE_RANGE, Query::OP_VALUE_RANGE);
+ ENUM_CONST(OP_SCALE_WEIGHT, Query::OP_SCALE_WEIGHT);
ENUM_CONST(OP_ELITE_SET, Query::OP_ELITE_SET);
+ ENUM_CONST(OP_VALUE_GE, Query::OP_VALUE_GE);
+ ENUM_CONST(OP_VALUE_LE, Query::OP_VALUE_LE);
ENUM_CONST(DB_OPEN, DB_OPEN);
ENUM_CONST(DB_CREATE, DB_CREATE);
Modified: trunk/libsearch-xapian-perl/Xapian/Enquire.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/Xapian/Enquire.pm?rev=18191&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/Xapian/Enquire.pm (original)
+++ trunk/libsearch-xapian-perl/Xapian/Enquire.pm Mon Mar 31 15:39:19 2008
@@ -248,9 +248,7 @@
=item get_eset
-=item register_match_decoder <name> <mdecider>
-
-See Xapian API documentation for these functions.
+Get set of query expansion terms.
=item get_description
Modified: trunk/libsearch-xapian-perl/Xapian/Query.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/Xapian/Query.pm?rev=18191&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/Xapian/Query.pm (original)
+++ trunk/libsearch-xapian-perl/Xapian/Query.pm Mon Mar 31 15:39:19 2008
@@ -21,41 +21,31 @@
my $class = shift;
my $query;
- if( scalar(@_) == 1 ) {
+ if( @_ == 1 ) {
$query = new1(@_);
} else {
- my $op = shift;
- if( $op !~ /^[-+]?\d+$/ ) {
- Carp::carp( "new()'s first argument must be an OP when called with more than one argument" );
- } elsif( $op == 8 ) { # FIXME: 8 is OP_VALUE_RANGE; eliminate hardcoded literal
- if( scalar(@_) != 3 ) {
- Carp::carp( "new() must have 4 arguments when OP is OP_VALUE_RANGE" );
- } else {
- $query = new4range( $op, @_ );
+ my $op = $_[0];
+ if( $op !~ /^\d+$/ ) {
+ Carp::croak( "USAGE: $class->new('term') or $class->new(OP, <args>)" );
+ }
+ if( $op == 8 ) { # FIXME: 8 is OP_VALUE_RANGE; eliminate hardcoded literal
+ if( @_ != 4 ) {
+ Carp::croak( "USAGE: $class->new(OP_VALUE_RANGE, VALNO, START, END)" );
}
- } elsif( !_all_equal( map { ref } @_ ) ) {
- Carp::carp( "all of new()'s arguments after the first must be of identical type (either all search terms (scalars) or $class objects)");
+ $query = new4range( @_ );
+ } elsif( $op == 9 ) { # FIXME: OP_SCALE_WEIGHT
+ if( @_ != 3 ) {
+ Carp::croak( "USAGE: $class->new(OP_SCALE_WEIGHT, QUERY, FACTOR)" );
+ }
+ $query = new3scale( @_ );
+ } elsif( $op == 11 || $op == 12 ) { # FIXME: OP_VALUE_GE, OP_VALUE_LE; eliminate hardcoded literals
+ if( @_ != 3 ) {
+ Carp::croak( "USAGE: $class->new(OP_VALUE_[GL]E, VALNO, LIMIT)" );
+ }
+ $query = new3range( @_ );
} else {
- # remaining arguments are scalars
- if( !ref($_[0]) ) {
- scalar(@_) == 1 ?
- $query = new2sv($op, @_) :
- $query = newXsv($op, @_);
- }
- # remaining arguments objects
- elsif( ref($_[0]) eq $class ) {
- scalar(@_) == 1 ?
- $query = new2obj($op, @_) :
- $query = newXobj($op, @_);
- }
- else {
- Carp::carp( "all of new()'s arguments after the first must be search terms (scalars), or $class objects" );
- }
+ $query = newN( @_ );
}
- }
- unless( defined $query ) {
- Carp::carp( "USAGE: $class->new('term'), $class->new(OP, \@terms), $class->new(OP, \@queries), or $class->new(OP_VALUE_RANGE, VALNO, START, END)" );
- exit;
}
bless $query, $class;
return $query;
@@ -78,14 +68,6 @@
return $query;
}
-sub _all_equal {
- my $first = shift;
- while(@_) {
- return 0 if $first ne shift;
- }
- return 1;
-}
-
sub get_terms {
my $self = shift;
my @terms;
Modified: trunk/libsearch-xapian-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/debian/changelog?rev=18191&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/debian/changelog (original)
+++ trunk/libsearch-xapian-perl/debian/changelog Mon Mar 31 15:39:19 2008
@@ -1,3 +1,9 @@
+libsearch-xapian-perl (1.0.6.0-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+
+ -- gregor herrmann <gregor+debian at comodo.priv.at> Mon, 31 Mar 2008 17:36:39 +0200
+
libsearch-xapian-perl (1.0.5.0-1) unstable; urgency=low
[ gregor herrmann ]
Modified: trunk/libsearch-xapian-perl/t/index.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/t/index.t?rev=18191&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/t/index.t (original)
+++ trunk/libsearch-xapian-perl/t/index.t Mon Mar 31 15:39:19 2008
@@ -6,7 +6,7 @@
# change 'tests => 1' to 'tests => last_test_to_print';
use Test::More;
-BEGIN { plan tests => 52 };
+BEGIN { plan tests => 76 };
use Search::Xapian qw(:standard);
#########################
@@ -62,6 +62,22 @@
$posit++;
ok( $posit eq $database->positionlist_end(1, $term) );
+ my $alltermit = $database->allterms_begin();
+ ok( $alltermit != $database->allterms_end() );
+ ok( "$alltermit" eq 'one' );
+ ok( ++$alltermit != $database->allterms_end() );
+ ok( "$alltermit" eq 'test' );
+ ok( ++$alltermit != $database->allterms_end() );
+ ok( "$alltermit" eq 'two' );
+ ok( ++$alltermit == $database->allterms_end() );
+
+ $alltermit = $database->allterms_begin('t');
+ ok( $alltermit != $database->allterms_end('t') );
+ ok( "$alltermit" eq 'test' );
+ ok( ++$alltermit != $database->allterms_end('t') );
+ ok( "$alltermit" eq 'two' );
+ ok( ++$alltermit == $database->allterms_end('t') );
+
# Feature test for metadata support.
is( $database->get_metadata( "nothing" ), "" );
is( $database->get_metadata( "foo" ), "" );
Modified: trunk/libsearch-xapian-perl/t/search.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/t/search.t?rev=18191&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/t/search.t (original)
+++ trunk/libsearch-xapian-perl/t/search.t Mon Mar 31 15:39:19 2008
@@ -6,7 +6,7 @@
# change 'tests => 1' to 'tests => last_test_to_print';
use Test::More;
-BEGIN { plan tests => 98 };
+BEGIN { plan tests => 108 };
use Search::Xapian qw(:ops);
#########################
@@ -35,16 +35,17 @@
}
is( $query->get_description, "Xapian::Query(help)", "query parsed correctly" );
-# tests 15-32
+# tests 15-41
$subqueries[1] = Search::Xapian::Query->new( 'help' );
foreach my $op (OP_OR, OP_AND, OP_NEAR, OP_PHRASE,
OP_AND_NOT, OP_XOR, OP_AND_MAYBE, OP_FILTER, OP_ELITE_SET) {
ok( $query = Search::Xapian::Query->new( $op, @subqueries ), "$Search::Xapian::OP_NAMES[$op] works with 2 objects" );
+ 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" );
-# tests 33-40
+# tests 42-...
$subqueries[2] = Search::Xapian::Query->new( 'one' );
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" );
@@ -54,6 +55,8 @@
ok( $enq = $db->enquire( $query ), "db queries return ok" );
ok( $enq = $db->enquire( OP_OR, 'test', 'help' ), "in-line db queries return ok" );
+
+ok( $query = Search::Xapian::Query->new(OP_SCALE_WEIGHT, $query, 3.14), "OP_SCALE_WEIGHT understood" );
my $matches;
ok( $matches = $enq->get_mset( 0, 10 ), "match set returned ok" );
Modified: trunk/libsearch-xapian-perl/t/sorter.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/t/sorter.t?rev=18191&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/t/sorter.t (original)
+++ trunk/libsearch-xapian-perl/t/sorter.t Mon Mar 31 15:39:19 2008
@@ -45,56 +45,57 @@
$enquire->set_query(Search::Xapian::Query->new("foo"));
-my @matches;
{
- $sorter = Search::Xapian::MultiValueSorter->new();
- $sorter->add(0);
- $enquire->set_sort_by_key($sorter);
- @matches = $enquire->matches(0, 10);
+ {
+ my $sorter = Search::Xapian::MultiValueSorter->new();
+ $sorter->add(0);
+ $enquire->set_sort_by_key($sorter);
+ }
+ my @matches = $enquire->matches(0, 10);
mset_expect_order(@matches, (5, 4, 3, 2, 1));
}
{
- $sorter = Search::Xapian::MultiValueSorter->new();
+ my $sorter = Search::Xapian::MultiValueSorter->new();
$sorter->add(0, 0);
$enquire->set_sort_by_key($sorter);
- @matches = $enquire->matches(0, 10);
+ my @matches = $enquire->matches(0, 10);
mset_expect_order(@matches, (1, 2, 3, 4, 5));
}
{
- $sorter = Search::Xapian::MultiValueSorter->new();
+ my $sorter = Search::Xapian::MultiValueSorter->new();
$sorter->add(0);
$sorter->add(1);
$enquire->set_sort_by_key($sorter);
- @matches = $enquire->matches(0, 10);
+ my @matches = $enquire->matches(0, 10);
mset_expect_order(@matches, (5, 4, 3, 2, 1));
}
{
- $sorter = Search::Xapian::MultiValueSorter->new();
+ my $sorter = Search::Xapian::MultiValueSorter->new();
$sorter->add(0, 0);
$sorter->add(1);
$enquire->set_sort_by_key($sorter);
- @matches = $enquire->matches(0, 10);
+ my @matches = $enquire->matches(0, 10);
mset_expect_order(@matches, (1, 2, 3, 4, 5));
}
{
- $sorter = Search::Xapian::MultiValueSorter->new();
+ my $sorter = Search::Xapian::MultiValueSorter->new();
$sorter->add(0);
$sorter->add(1, 0);
$enquire->set_sort_by_key($sorter);
- @matches = $enquire->matches(0, 10);
+ my @matches = $enquire->matches(0, 10);
mset_expect_order(@matches, (5, 4, 3, 2, 1));
}
{
- $sorter = Search::Xapian::MultiValueSorter->new();
+ my $sorter = Search::Xapian::MultiValueSorter->new();
$sorter->add(0, 0);
$sorter->add(1, 0);
$enquire->set_sort_by_key($sorter);
- @matches = $enquire->matches(0, 10);
+ my @matches = $enquire->matches(0, 10);
mset_expect_order(@matches, (1, 2, 3, 4, 5));
}
Modified: trunk/libsearch-xapian-perl/t/valuerange.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/t/valuerange.t?rev=18191&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/t/valuerange.t (original)
+++ trunk/libsearch-xapian-perl/t/valuerange.t Mon Mar 31 15:39:19 2008
@@ -6,7 +6,7 @@
# change 'tests => 1' to 'tests => last_test_to_print';
use Test::More;
-BEGIN { plan tests => 14 };
+BEGIN { plan tests => 22 };
use Search::Xapian qw(:all);
#########################
@@ -50,4 +50,20 @@
++$mseti;
is( $mseti->get_document()->get_value(0), "two" );
+ok( $query = Search::Xapian::Query->new(OP_VALUE_LE, 0, "one") );
+$enq->set_query($query);
+ok( $mset = $enq->get_mset(0, 10), "got mset" );
+# FIXME: bug in xapian-core in 1.0.6 and earlier means this gives the wrong answer
+#is( $mset->size, 1, "range ..one ok" );
+ok( 1 );
+$mseti = $mset->begin();
+is( $mseti->get_document()->get_value(0), "one" );
+
+ok( $query = Search::Xapian::Query->new(OP_VALUE_GE, 0, "two") );
+$enq->set_query($query);
+ok( $mset = $enq->get_mset(0, 10), "got mset" );
+is( $mset->size, 1, "range one.. ok" );
+$mseti = $mset->begin();
+is( $mseti->get_document()->get_value(0), "two" );
+
1;
More information about the Pkg-perl-cvs-commits
mailing list