diff -NaurpBb Search-Xapian-1.2.6.0/Xapian/WritableDatabase.pm Search-Xapian-mod/Xapian/WritableDatabase.pm
old
|
new
|
sub new() {
|
29 | 29 | my $class = shift; |
30 | 30 | my $database; |
31 | 31 | my $invalid_args; |
32 | | if( scalar(@_) == 1 ) { |
| 32 | if( @_ == 1 ) { |
33 | 33 | my $arg = shift; |
34 | 34 | my $arg_class = ref( $arg ); |
35 | 35 | if( $arg_class eq $class ) { |
… |
… |
sub new() {
|
37 | 37 | } else { |
38 | 38 | $invalid_args = 1; |
39 | 39 | } |
40 | | } elsif( scalar(@_) == 2 ) { |
| 40 | } elsif( @_ >= 2 ) { |
41 | 41 | $database = new1( @_ ); |
42 | | } elsif( scalar(@_) == 0 ) { |
| 42 | } elsif( !@_ ) { |
43 | 43 | $database = new3(); |
44 | 44 | } else { |
45 | 45 | $invalid_args = 1; |
46 | 46 | } |
47 | 47 | if( $invalid_args ) { |
48 | | Carp::carp( "USAGE: $class->new(\$file, DB_OPTS), $class->new(\$database), $class->new()" ); |
| 48 | Carp::carp( "USAGE: $class->new(\$file, DB_OPTS[, BACKEND]), $class->new(\$database), $class->new()" ); |
49 | 49 | exit; |
50 | 50 | } |
51 | 51 | bless $database, $class; |
… |
… |
L<Search::Xapian::Database>, which is us
|
69 | 69 | |
70 | 70 | =over 4 |
71 | 71 | |
72 | | =item new <database> or new <path> <mode> |
| 72 | =item new <database> or new <path> <mode> [backend] [block size] |
73 | 73 | |
74 | | Class constructor. Takes either a database object, or a path and one |
75 | | of DB_OPEN, DB_CREATE, DB_CREATE_OR_OPEN or DB_CREATE_OR_OVERWRITE. |
76 | | These are exported by L<Search::Xapian> with the 'db' option. |
| 74 | Class constructor. Takes either a database object, or a path to database directory, |
| 75 | mode, which is one of DB_OPEN, DB_CREATE, DB_CREATE_OR_OPEN or DB_CREATE_OR_OVERWRITE, |
| 76 | exported by L<Search::Xapian> with the ':db' option, backend selector, |
| 77 | which is one of BACKEND_FLINT, BACKEND_CHERT (default) and BACKEND_BRASS, |
| 78 | exported by L<Search::Xapian> with the ':backend' option, and block size |
| 79 | (default 8192). |
77 | 80 | |
78 | 81 | =item clone |
79 | 82 | |
diff -NaurpBb Search-Xapian-1.2.6.0/Xapian.pm Search-Xapian-mod/Xapian.pm
old
|
new
|
our %EXPORT_TAGS = (
|
91 | 91 | STEM_NONE |
92 | 92 | STEM_SOME |
93 | 93 | STEM_ALL |
94 | | ) ] |
| 94 | ) ], |
| 95 | 'backend' => [ qw( |
| 96 | BACKEND_FLINT |
| 97 | BACKEND_CHERT |
| 98 | BACKEND_BRASS |
| 99 | ) ], |
95 | 100 | ); |
96 | 101 | $EXPORT_TAGS{standard} = [ @{ $EXPORT_TAGS{'ops'} }, |
97 | 102 | @{ $EXPORT_TAGS{'db'} }, |
98 | 103 | @{ $EXPORT_TAGS{'qpflags'} }, |
99 | 104 | @{ $EXPORT_TAGS{'qpstem'} } ]; |
100 | | $EXPORT_TAGS{all} = [ @{ $EXPORT_TAGS{'standard'} }, @{ $EXPORT_TAGS{'enq_order'} } ]; |
| 105 | $EXPORT_TAGS{all} = [ @{ $EXPORT_TAGS{'standard'} }, |
| 106 | @{ $EXPORT_TAGS{'backend'} }, |
| 107 | @{ $EXPORT_TAGS{'enq_order'} } ]; |
101 | 108 | |
102 | 109 | |
103 | 110 | # Names which can be exported. |
… |
… |
Overwrite database if it exists.
|
205 | 212 | |
206 | 213 | =back |
207 | 214 | |
| 215 | =head1 :backend |
| 216 | |
| 217 | =item BACKEND_FLINT |
| 218 | |
| 219 | Tells L<Search::Xapian::WritableDatabase>'s constructor to use |
| 220 | Flint backend for newly created databases. Flint is the "old stable" |
| 221 | backend in Xapian 1.2.x. Use Chert instead. |
| 222 | |
| 223 | =item BACKEND_CHERT |
| 224 | |
| 225 | Tells L<Search::Xapian::WritableDatabase>'s constructor to use |
| 226 | Chert backend for newly created databases. Chert is considered stable |
| 227 | in Xapian 1.2.x and is the default. |
| 228 | |
| 229 | =item BACKEND_BRASS |
| 230 | |
| 231 | Tells L<Search::Xapian::WritableDatabase>'s constructor to use |
| 232 | Brass backend for newly created databases. Brass is the development |
| 233 | backend and will be considered stable in 1.4.0. |
| 234 | |
208 | 235 | =head1 :ops |
209 | 236 | |
210 | 237 | =over 4 |
diff -NaurpBb Search-Xapian-1.2.6.0/Xapian.xs Search-Xapian-mod/Xapian.xs
old
|
new
|
extern "C" {
|
22 | 22 | using namespace std; |
23 | 23 | using namespace Xapian; |
24 | 24 | |
| 25 | #define XAPIAN_BACKEND_FLINT 1 |
| 26 | #define XAPIAN_BACKEND_CHERT 2 |
| 27 | #define XAPIAN_BACKEND_BRASS 3 |
| 28 | |
25 | 29 | extern void handle_exception(void); |
26 | 30 | |
27 | 31 | /* PerlStopper class |
… |
… |
BOOT:
|
245 | 249 | ENUM_CONST(FLAG_AUTO_MULTIWORD_SYNONYMS, QueryParser::FLAG_AUTO_SYNONYMS); |
246 | 250 | ENUM_CONST(FLAG_DEFAULT, QueryParser::FLAG_DEFAULT); |
247 | 251 | |
| 252 | ENUM_CONST(BACKEND_FLINT, XAPIAN_BACKEND_FLINT); |
| 253 | ENUM_CONST(BACKEND_CHERT, XAPIAN_BACKEND_CHERT); |
| 254 | ENUM_CONST(BACKEND_BRASS, XAPIAN_BACKEND_BRASS); |
| 255 | |
248 | 256 | ENUM_CONST(STEM_NONE, QueryParser::STEM_NONE); |
249 | 257 | ENUM_CONST(STEM_SOME, QueryParser::STEM_SOME); |
250 | 258 | ENUM_CONST(STEM_ALL, QueryParser::STEM_ALL); |
diff -NaurpBb Search-Xapian-1.2.6.0/XS/WritableDatabase.xs Search-Xapian-mod/XS/WritableDatabase.xs
old
|
new
|
MODULE = Search::Xapian PACKAGE = Searc
|
3 | 3 | PROTOTYPES: ENABLE |
4 | 4 | |
5 | 5 | WritableDatabase * |
6 | | new1(file, opts) |
| 6 | new1(file, opts, backend = XAPIAN_BACKEND_CHERT, blocksize = 8192) |
7 | 7 | string file |
8 | 8 | int opts |
| 9 | int backend |
| 10 | int blocksize |
9 | 11 | CODE: |
10 | 12 | try { |
11 | | RETVAL = new WritableDatabase(file, opts); |
| 13 | switch (backend) { |
| 14 | case XAPIAN_BACKEND_FLINT: |
| 15 | RETVAL = new WritableDatabase(Xapian::Flint::open(file, opts, blocksize)); |
| 16 | break; |
| 17 | case XAPIAN_BACKEND_BRASS: |
| 18 | RETVAL = new WritableDatabase(Xapian::Brass::open(file, opts, blocksize)); |
| 19 | break; |
| 20 | case XAPIAN_BACKEND_CHERT: |
| 21 | default: |
| 22 | RETVAL = new WritableDatabase(Xapian::Chert::open(file, opts, blocksize)); |
| 23 | } |
12 | 24 | } catch (...) { |
13 | 25 | handle_exception(); |
14 | 26 | } |