r52780 - in /trunk/libsearch-xapian-perl: ./ XS/ Xapian/ debian/ t/

olly at users.alioth.debian.org olly at users.alioth.debian.org
Mon Feb 15 08:57:02 UTC 2010


Author: olly
Date: Mon Feb 15 08:56:53 2010
New Revision: 52780

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=52780
Log:
* New upstream release
* debian/copyright:
  - Fix some infelicities in the details.
  - Update for 2010 copyrights.
* Bump Standards-Version to 3.8.4 (no changes).

Modified:
    trunk/libsearch-xapian-perl/Changes
    trunk/libsearch-xapian-perl/META.yml
    trunk/libsearch-xapian-perl/README
    trunk/libsearch-xapian-perl/XS/Database.xs
    trunk/libsearch-xapian-perl/XS/QueryParser.xs
    trunk/libsearch-xapian-perl/XS/WritableDatabase.xs
    trunk/libsearch-xapian-perl/Xapian.pm
    trunk/libsearch-xapian-perl/Xapian/Database.pm
    trunk/libsearch-xapian-perl/Xapian/QueryParser.pm
    trunk/libsearch-xapian-perl/Xapian/WritableDatabase.pm
    trunk/libsearch-xapian-perl/debian/changelog
    trunk/libsearch-xapian-perl/debian/control
    trunk/libsearch-xapian-perl/debian/copyright
    trunk/libsearch-xapian-perl/t/index.t
    trunk/libsearch-xapian-perl/t/parser.t
    trunk/libsearch-xapian-perl/t/search.t

Modified: trunk/libsearch-xapian-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/Changes?rev=52780&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/Changes (original)
+++ trunk/libsearch-xapian-perl/Changes Mon Feb 15 08:56:53 2010
@@ -1,4 +1,8 @@
 Revision history for Perl extension Search::Xapian.
+
+1.0.18.0  Sun Feb 14 10:22:53 UTC 2010
+	[Changes contributed by Henry Combrinck]
+	- Add wrappers for the spelling correction functionality (ticket#420).
 
 1.0.17.0  Wed Nov 18 02:02:41 UTC 2009
 	[Changes contributed by Olly Betts]

Modified: trunk/libsearch-xapian-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/META.yml?rev=52780&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/META.yml (original)
+++ trunk/libsearch-xapian-perl/META.yml Mon Feb 15 08:56:53 2010
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                Search-Xapian
-version:             1.0.17.0
+version:             1.0.18.0
 abstract:            Perl XS frontend to the Xapian C++ search library.
 license:             ~
 author:              

Modified: trunk/libsearch-xapian-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/README?rev=52780&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/README (original)
+++ trunk/libsearch-xapian-perl/README Mon Feb 15 08:56:53 2010
@@ -1,4 +1,4 @@
-Search::Xapian version 1.0.17.0
+Search::Xapian version 1.0.18.0
 ===============================
 
 This is Search::Xapian, a Perl XS frontend to the Xapian C++ search library.
@@ -42,7 +42,7 @@
 CPAN bug tracker or mail any of the authors individually.
 
 Copyright (c) 2002,2003 Alex Bowley. All rights reserved.
-Copyright (c) 2003,2004,2005,2006,2007,2008,2009 Olly Betts. All rights reserved.
+Copyright (c) 2003,2004,2005,2006,2007,2008,2009,2010 Olly Betts. All rights reserved.
 
 This program is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.

Modified: trunk/libsearch-xapian-perl/XS/Database.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/XS/Database.xs?rev=52780&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/XS/Database.xs (original)
+++ trunk/libsearch-xapian-perl/XS/Database.xs Mon Feb 15 08:56:53 2010
@@ -278,6 +278,19 @@
         RETVAL
 
 string
+Database::get_spelling_suggestion(word, max_edit_distance = 2)
+    string  word
+    int     max_edit_distance
+    CODE:
+	try {
+	    RETVAL = THIS->get_spelling_suggestion(word, max_edit_distance);
+	} catch (const Error &error) {
+	    croak( "Exception: %s", error.get_msg().c_str() );
+	}
+    OUTPUT:
+	RETVAL
+
+string
 Database::get_metadata(string key)
     CODE:
 	try {

Modified: trunk/libsearch-xapian-perl/XS/QueryParser.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/XS/QueryParser.xs?rev=52780&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/XS/QueryParser.xs (original)
+++ trunk/libsearch-xapian-perl/XS/QueryParser.xs Mon Feb 15 08:56:53 2010
@@ -99,6 +99,17 @@
 	RETVAL
 
 string
+QueryParser::get_corrected_query_string()
+    CODE:
+    try {
+	RETVAL = THIS->get_corrected_query_string();
+    } catch (const Error &error) {
+	croak( "Exception: %s", error.get_msg().c_str() );
+    }
+    OUTPUT:
+	RETVAL
+
+string
 QueryParser::get_description()
 
 void

Modified: trunk/libsearch-xapian-perl/XS/WritableDatabase.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/XS/WritableDatabase.xs?rev=52780&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/XS/WritableDatabase.xs (original)
+++ trunk/libsearch-xapian-perl/XS/WritableDatabase.xs Mon Feb 15 08:56:53 2010
@@ -417,3 +417,25 @@
 	} catch (const Error &error) {
 	    croak( "Exception: %s", error.get_msg().c_str() );
 	}
+
+void
+WritableDatabase::add_spelling(word, freqinc = 1)
+    string word
+    termcount freqinc
+    CODE:
+	try {
+	    THIS->add_spelling(word, freqinc);
+	} catch (const Error &error) {
+	    croak( "Exception: %s", error.get_msg().c_str() );
+	}
+
+void
+WritableDatabase::remove_spelling(word, freqdec  = 1)
+    string word
+    termcount freqdec
+    CODE:
+	try {
+	    THIS->remove_spelling(word, freqdec);
+	} 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=52780&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/Xapian.pm (original)
+++ trunk/libsearch-xapian-perl/Xapian.pm Mon Feb 15 08:56:53 2010
@@ -4,7 +4,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '1.0.17.0';
+our $VERSION = '1.0.18.0';
 
 use Exporter 'import';
 

Modified: trunk/libsearch-xapian-perl/Xapian/Database.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/Xapian/Database.pm?rev=52780&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/Xapian/Database.pm (original)
+++ trunk/libsearch-xapian-perl/Xapian/Database.pm Mon Feb 15 08:56:53 2010
@@ -138,6 +138,10 @@
 
 return a description of this object.
 
+=item get_spelling_suggestion
+
+returns a suggested spelling correction.
+
 =item allterms_begin [<prefix>]
 
 Returns a L<Search::Xapian::TermIterator> iterating over the termlist for the

Modified: trunk/libsearch-xapian-perl/Xapian/QueryParser.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/Xapian/QueryParser.pm?rev=52780&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/Xapian/QueryParser.pm (original)
+++ trunk/libsearch-xapian-perl/Xapian/QueryParser.pm Mon Feb 15 08:56:53 2010
@@ -157,6 +157,15 @@
 
 Returns a string describing this object.
 
+=item get_corrected_query_string
+
+Get the spelling-corrected query string.
+
+This will only be set if FLAG_SPELLING_CORRECTION is specified when
+QueryParser::parse_query() was last called.
+
+If there were no corrections, an empty string is returned.
+
 =back
 
 =head1 REFERENCE

Modified: trunk/libsearch-xapian-perl/Xapian/WritableDatabase.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/Xapian/WritableDatabase.pm?rev=52780&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/Xapian/WritableDatabase.pm (original)
+++ trunk/libsearch-xapian-perl/Xapian/WritableDatabase.pm Mon Feb 15 08:56:53 2010
@@ -174,9 +174,30 @@
 replaced and an exception is thrown (possibly at a later time when flush is
 called or the database is closed).
 
+=item add_spelling <word> <freqinc>
+
+Add a word to the spelling dictionary.
+
+If the word is already present, its frequency is increased.
+
+Parameters:
+    word        The word to add.
+    freqinc     How much to increase its frequency by (default 1).
+
+=item remove_spelling <word> <freqdec>
+
+Remove a word from the spelling dictionary.
+
+The word's frequency is decreased, and if would become zero or less
+then the word is removed completely.
+
+Parameters:
+    word        The word to remove.
+    freqdec     How much to decrease its frequency by (default 1).
+
 =item reopen
 
-Re-open the database. makes sure you have a fresh db handle.
+Re-open the database to ensure you are using the latest revision.
 
 =back
 

Modified: trunk/libsearch-xapian-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/debian/changelog?rev=52780&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/debian/changelog (original)
+++ trunk/libsearch-xapian-perl/debian/changelog Mon Feb 15 08:56:53 2010
@@ -1,3 +1,13 @@
+libsearch-xapian-perl (1.0.18.0-1) unstable; urgency=low
+
+  * New upstream release
+  * debian/copyright:
+    - Fix some infelicities in the details.
+    - Update for 2010 copyrights.
+  * Bump Standards-Version to 3.8.4 (no changes).
+
+ -- Olly Betts <olly at survex.com>  Mon, 15 Feb 2010 08:54:43 +0000
+
 libsearch-xapian-perl (1.0.17.0-1) unstable; urgency=low
 
   [Olly Betts]

Modified: trunk/libsearch-xapian-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/debian/control?rev=52780&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/debian/control (original)
+++ trunk/libsearch-xapian-perl/debian/control Mon Feb 15 08:56:53 2010
@@ -10,7 +10,7 @@
  Ryan Niebur <ryan at debian.org>, Jonathan Yu <jawnsy at cpan.org>,
  Salvatore Bonaccorso <salvatore.bonaccorso at gmail.com>,
  Xavier Oswald <xoswald at debian.org>, Olly Betts <olly at survex.com>
-Standards-Version: 3.8.3
+Standards-Version: 3.8.4
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libsearch-xapian-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libsearch-xapian-perl/
 Homepage: http://xapian.org/

Modified: trunk/libsearch-xapian-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/debian/copyright?rev=52780&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/debian/copyright (original)
+++ trunk/libsearch-xapian-perl/debian/copyright Mon Feb 15 08:56:53 2010
@@ -5,14 +5,18 @@
 Upstream-Name: Search-Xapian
 
 Files: *
-Copyright: 2003-2009, Olly Betts <olly at survex.com>
- 2002-2003 Alex Bowley <kilinrax at cpan.org>
+Copyright: 2002,2003 Alex Bowley <kilinrax at cpan.org>
+ 2003,2004,2005,2006,2007,2008,2009,2010, Olly Betts <olly at survex.com>
 License-Alias: Perl
 License: Artistic | GPL-1+
 
 Files: examples/simple*
 Copyright: 2003, James Aylett <james at tartarus.org>
- 2004, 2007, 2009, Olly Betts <olly at survex.com>
+ 2004,2006,2007,2009, Olly Betts <olly at survex.com>
+License: GPL-2+
+
+Files: examples/full*
+Copyright: 2009, Olly Betts <olly at survex.com>
 License: GPL-2+
 
 Files: debian/*
@@ -24,7 +28,7 @@
  2007-2008, Damyan Ivanov <dmn at debian.org>
  2006-2008, Frank Lichtenheld <djpig at debian.org>
  2007, Krzysztof Krzyzaniak (eloy) <eloy at debian.org>
- 2009, Olly Betts <olly at survex.com>
+ 2009,2010, Olly Betts <olly at survex.com>
 License: Artistic | GPL-1+
 
 License: Artistic

Modified: trunk/libsearch-xapian-perl/t/index.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/t/index.t?rev=52780&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/t/index.t (original)
+++ trunk/libsearch-xapian-perl/t/index.t Mon Feb 15 08:56:53 2010
@@ -32,6 +32,10 @@
 
   my $term = 'test';
   ok( $term = $stemmer->stem_word( $term ) );
+  if ($backend ne "inmemory") {
+    # inmemory doesn't implement spelling correction support.
+    $database->add_spelling( $term, 1 );
+  }
 
   my $docid;
   for my $num qw( one two three ) {
@@ -44,6 +48,13 @@
     $docs{$num}->add_posting( $num, 1 );
 
     $docs{$num}->add_value(0, $num);
+
+    if ($backend ne "inmemory") {
+      # inmemory doesn't implement spelling correction support.
+      $database->add_spelling( "x" . $term, 1 );
+      $database->add_spelling( $term, 1 );
+      $database->remove_spelling( "x" . $term, 1 );
+    }
     ok( $docid = $database->add_document( $docs{$num} ) );
   }
   $database->delete_document( $docid );

Modified: trunk/libsearch-xapian-perl/t/parser.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/t/parser.t?rev=52780&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/t/parser.t (original)
+++ trunk/libsearch-xapian-perl/t/parser.t Mon Feb 15 08:56:53 2010
@@ -6,7 +6,7 @@
 
 use Test;
 use Devel::Peek;
-BEGIN { plan tests => 53 };
+BEGIN { plan tests => 54 };
 use Search::Xapian qw(:standard);
 ok(1); # If we made it this far, we're ok.
 
@@ -29,7 +29,8 @@
 $qp->set_default_op( OP_AND );
 
 my $query;
-ok( $query = $qp->parse_query( 'one or two', FLAG_BOOLEAN|FLAG_BOOLEAN_ANY_CASE ) );
+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( $query = $qp->parse_query( 'one OR (two AND three)' ) );

Modified: trunk/libsearch-xapian-perl/t/search.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsearch-xapian-perl/t/search.t?rev=52780&op=diff
==============================================================================
--- trunk/libsearch-xapian-perl/t/search.t (original)
+++ trunk/libsearch-xapian-perl/t/search.t Mon Feb 15 08:56:53 2010
@@ -6,7 +6,7 @@
 # change 'tests => 1' to 'tests => last_test_to_print';
 
 use Test::More;
-BEGIN { plan tests => 114 };
+BEGIN { plan tests => 115 };
 use Search::Xapian qw(:ops);
 
 #########################
@@ -55,6 +55,7 @@
 
 ok( $enq = $db->enquire( $query ), "db queries return ok"  );
 ok( $enq = $db->enquire( OP_OR, 'test', 'help' ), "in-line db queries return ok" );
+is( $db->get_spelling_suggestion( 'tost' ), 'test', "spelling suggestion ok" );
 
 ok( $query = Search::Xapian::Query->new(OP_SCALE_WEIGHT, $query, 3.14), "OP_SCALE_WEIGHT understood" );
 




More information about the Pkg-perl-cvs-commits mailing list