isomorfeus-ferret 0.14.4 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +56 -6
- data/ext/isomorfeus_ferret_ext/extconf.rb +19 -1
- data/ext/isomorfeus_ferret_ext/frb_analysis.c +0 -4
- data/ext/isomorfeus_ferret_ext/frb_index.c +170 -52
- data/ext/isomorfeus_ferret_ext/frb_lazy_doc.c +4 -0
- data/ext/isomorfeus_ferret_ext/frb_qparser.c +1 -6
- data/ext/isomorfeus_ferret_ext/frb_search.c +1 -6
- data/ext/isomorfeus_ferret_ext/frb_store.c +246 -61
- data/ext/isomorfeus_ferret_ext/frb_utils.c +0 -4
- data/ext/isomorfeus_ferret_ext/frt_compound_io.c +5 -5
- data/ext/isomorfeus_ferret_ext/frt_except.c +11 -11
- data/ext/isomorfeus_ferret_ext/frt_hash.c +32 -70
- data/ext/isomorfeus_ferret_ext/frt_ind.c +20 -20
- data/ext/isomorfeus_ferret_ext/frt_ind.h +1 -1
- data/ext/isomorfeus_ferret_ext/frt_index.c +84 -90
- data/ext/isomorfeus_ferret_ext/frt_index.h +11 -11
- data/ext/isomorfeus_ferret_ext/frt_mdbx_store.c +749 -0
- data/ext/isomorfeus_ferret_ext/frt_q_parser.c +4 -4
- data/ext/isomorfeus_ferret_ext/frt_ram_store.c +9 -9
- data/ext/isomorfeus_ferret_ext/frt_search.c +0 -3
- data/ext/isomorfeus_ferret_ext/frt_search.h +1 -1
- data/ext/isomorfeus_ferret_ext/frt_sort.c +2 -2
- data/ext/isomorfeus_ferret_ext/frt_store.c +6 -8
- data/ext/isomorfeus_ferret_ext/frt_store.h +37 -24
- data/ext/isomorfeus_ferret_ext/frt_threading.h +0 -16
- data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.c +2 -11
- data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.h +1 -1
- data/ext/isomorfeus_ferret_ext/mdbx.c +33675 -0
- data/ext/isomorfeus_ferret_ext/mdbx.h +5495 -0
- data/ext/isomorfeus_ferret_ext/test.c +9 -9
- data/ext/isomorfeus_ferret_ext/test_index.c +3 -3
- data/ext/isomorfeus_ferret_ext/{test_fs_store.c → test_mdbx_store.c} +4 -10
- data/ext/isomorfeus_ferret_ext/test_ram_store.c +1 -1
- data/ext/isomorfeus_ferret_ext/test_segments.c +1 -1
- data/ext/isomorfeus_ferret_ext/test_sort.c +2 -2
- data/ext/isomorfeus_ferret_ext/test_store.c +4 -8
- data/ext/isomorfeus_ferret_ext/test_threading.c +4 -4
- data/ext/isomorfeus_ferret_ext/tests_all.h +2 -3
- data/lib/isomorfeus/ferret/index/index.rb +8 -9
- data/lib/isomorfeus/ferret/version.rb +1 -1
- metadata +9 -7
- data/ext/isomorfeus_ferret_ext/frt_fs_store.c +0 -505
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0910e1e8d9cb68f71275b885c83ac427fd06163d19c9d3353a5eac3899bf91a8'
|
4
|
+
data.tar.gz: b057b640008ef4384a7d118bb97ad6644c51b2fef0986bb02bc3ac296a423f8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8437a6d16ff08ebc05f78169a0ca1bfa6627b3994ecae09b25a1373a7cfd41c8836ee21cf0485f0b1008d34488da8f4e781a50e92f9847527f5f6c2b8729d3df
|
7
|
+
data.tar.gz: 7742111e748ba8adb135d50a8d676eb57c63e2bd723b5099a000f01f6e17dd0e3d1bfdd9e47bf7a5af67ad7ead75b6241b660af094f6b7e673115dd07e0abe7b
|
data/LICENSE
CHANGED
@@ -28,14 +28,14 @@ Copyright (c) 2005-2006 David Balmain
|
|
28
28
|
MIT License as above
|
29
29
|
|
30
30
|
|
31
|
-
brotli_* files in ext/
|
31
|
+
brotli_* files in ext/isomorfeus_ferret_ext originally taken from https://github.com/google/brotli:
|
32
32
|
|
33
33
|
Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.
|
34
34
|
|
35
35
|
MIT License as above
|
36
36
|
|
37
37
|
|
38
|
-
bzlib* files in ext/
|
38
|
+
bzlib* files in ext/isomorfeus_ferret_ext originally taken from git://sourceware.org/git/bzip2.git:
|
39
39
|
|
40
40
|
This program, "bzip2", the associated library "libbzip2", and all
|
41
41
|
documentation, are copyright (C) 1996-2019 Julian R Seward. All
|
@@ -76,7 +76,7 @@ Julian Seward, jseward@acm.org
|
|
76
76
|
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
77
77
|
|
78
78
|
|
79
|
-
lz4* files in ext/
|
79
|
+
lz4* files in ext/isomorfeus_ferret_ext originally taken from https://github.com/lz4/lz4/tree/dev/lib:
|
80
80
|
|
81
81
|
Copyright (C) 2011-2020, Yann Collet.
|
82
82
|
|
@@ -107,7 +107,7 @@ You can contact the author at:
|
|
107
107
|
- LZ4 source repository : https://github.com/lz4/lz4
|
108
108
|
|
109
109
|
|
110
|
-
stem* and libstemmer* files in ext/
|
110
|
+
stem* and libstemmer* files in ext/isomorfeus_ferret_ext originally taken from https://snowballstem.org/:
|
111
111
|
|
112
112
|
Copyright (c) 2001, Dr Martin Porter
|
113
113
|
Copyright (c) 2004,2005, Richard Boulton
|
@@ -139,11 +139,62 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
139
139
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
140
140
|
|
141
141
|
|
142
|
+
mdbx* files in ext/isomorfeus_ferret_ext originally taken from https://gitflic.ru/project/erthink/libmdbx:
|
143
|
+
|
144
|
+
The OpenLDAP Public License
|
145
|
+
Version 2.8, 17 August 2003
|
146
|
+
|
147
|
+
Redistribution and use of this software and associated documentation
|
148
|
+
("Software"), with or without modification, are permitted provided
|
149
|
+
that the following conditions are met:
|
150
|
+
|
151
|
+
1. Redistributions in source form must retain copyright statements
|
152
|
+
and notices,
|
153
|
+
|
154
|
+
2. Redistributions in binary form must reproduce applicable copyright
|
155
|
+
statements and notices, this list of conditions, and the following
|
156
|
+
disclaimer in the documentation and/or other materials provided
|
157
|
+
with the distribution, and
|
158
|
+
|
159
|
+
3. Redistributions must contain a verbatim copy of this document.
|
160
|
+
|
161
|
+
The OpenLDAP Foundation may revise this license from time to time.
|
162
|
+
Each revision is distinguished by a version number. You may use
|
163
|
+
this Software under terms of this license revision or under the
|
164
|
+
terms of any subsequent revision of the license.
|
165
|
+
|
166
|
+
THIS SOFTWARE IS PROVIDED BY THE OPENLDAP FOUNDATION AND ITS
|
167
|
+
CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
168
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
169
|
+
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
170
|
+
SHALL THE OPENLDAP FOUNDATION, ITS CONTRIBUTORS, OR THE AUTHOR(S)
|
171
|
+
OR OWNER(S) OF THE SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
172
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
173
|
+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
174
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
175
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
176
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
177
|
+
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
178
|
+
POSSIBILITY OF SUCH DAMAGE.
|
179
|
+
|
180
|
+
The names of the authors and copyright holders must not be used in
|
181
|
+
advertising or otherwise to promote the sale, use or other dealing
|
182
|
+
in this Software without specific, written prior permission. Title
|
183
|
+
to copyright in this Software shall at all times remain with copyright
|
184
|
+
holders.
|
185
|
+
|
186
|
+
OpenLDAP is a registered trademark of the OpenLDAP Foundation.
|
187
|
+
|
188
|
+
Copyright 1999-2003 The OpenLDAP Foundation, Redwood City,
|
189
|
+
California, USA. All Rights Reserved. Permission to copy and
|
190
|
+
distribute verbatim copies of this document is granted.
|
191
|
+
|
192
|
+
|
142
193
|
The following licenses apply to files, which are distributed within the repo
|
143
194
|
but not distributed with the gem and not used at runtime:
|
144
195
|
|
145
196
|
|
146
|
-
For the
|
197
|
+
For the Reuters-21578 files in the misc/ferret_vs_others directory (reuters-corpus, etc.),
|
147
198
|
used for research for developing search engine technology:
|
148
199
|
|
149
200
|
The copyright for the text of newswire articles and Reuters
|
@@ -158,7 +209,6 @@ the data set (see "Availability & Questions").
|
|
158
209
|
|
159
210
|
Apache Lucene jars in the misc/ferret_vs_others directory:
|
160
211
|
|
161
|
-
|
162
212
|
Apache License
|
163
213
|
Version 2.0, January 2004
|
164
214
|
http://www.apache.org/licenses/
|
@@ -1,5 +1,23 @@
|
|
1
1
|
require 'mkmf'
|
2
2
|
|
3
|
-
|
3
|
+
WIN_PATTERNS = [
|
4
|
+
/bccwin/i,
|
5
|
+
/cygwin/i,
|
6
|
+
/djgpp/i,
|
7
|
+
/mingw/i,
|
8
|
+
/mswin/i,
|
9
|
+
/wince/i,
|
10
|
+
].freeze
|
11
|
+
|
12
|
+
def win_platform?
|
13
|
+
ruby_platform = RbConfig::CONFIG['host_os']
|
14
|
+
!!WIN_PATTERNS.find {|r| ruby_platform =~ r }
|
15
|
+
end
|
16
|
+
|
17
|
+
$CFLAGS << ' -O2 -DMDBX_BUILD_FLAGS=\"-O2\" -Wall -Wno-sizeof-pointer-div'
|
18
|
+
|
19
|
+
if win_platform?
|
20
|
+
$LDFLAGS << ' -lntdll '
|
21
|
+
end
|
4
22
|
|
5
23
|
create_makefile('isomorfeus_ferret_ext')
|
@@ -2075,10 +2075,6 @@ static void Init_RegExpAnalyzer(void) {
|
|
2075
2075
|
rb_define_method(cRegExpAnalyzer, "token_stream", frb_re_analyzer_token_stream, 2);
|
2076
2076
|
}
|
2077
2077
|
|
2078
|
-
/* rdoc hack
|
2079
|
-
extern VALUE mFerret = rb_define_module("Ferret");
|
2080
|
-
*/
|
2081
|
-
|
2082
2078
|
/*
|
2083
2079
|
* Document-module: Ferret::Analysis
|
2084
2080
|
*
|
@@ -291,7 +291,7 @@ static VALUE frb_fis_create_index(VALUE self, VALUE rdir) {
|
|
291
291
|
} else {
|
292
292
|
StringValue(rdir);
|
293
293
|
frb_create_dir(rdir);
|
294
|
-
store =
|
294
|
+
store = frt_open_mdbx_store(rs2s(rdir));
|
295
295
|
frt_index_create(store, fis);
|
296
296
|
frt_store_close(store);
|
297
297
|
}
|
@@ -983,7 +983,7 @@ static VALUE frb_iw_close(VALUE self) {
|
|
983
983
|
* dir = RAMDirectory.new()
|
984
984
|
* iw = IndexWriter.new(:dir => dir)
|
985
985
|
*
|
986
|
-
* dir =
|
986
|
+
* dir = MDBXDirectory.new("/path/to/index")
|
987
987
|
* iw = IndexWriter.new(:dir => dir)
|
988
988
|
*
|
989
989
|
* iw = IndexWriter.new(:path => "/path/to/index")
|
@@ -1039,7 +1039,7 @@ static VALUE frb_iw_init(int argc, VALUE *argv, VALUE self) {
|
|
1039
1039
|
} else if ((rval = rb_hash_aref(roptions, sym_path)) != Qnil) {
|
1040
1040
|
StringValue(rval);
|
1041
1041
|
frb_create_dir(rval);
|
1042
|
-
store =
|
1042
|
+
store = frt_open_mdbx_store(rs2s(rval));
|
1043
1043
|
}
|
1044
1044
|
/* use_compound_file defaults to true */
|
1045
1045
|
config.use_compound_file =
|
@@ -1112,10 +1112,25 @@ static VALUE frb_iw_init(int argc, VALUE *argv, VALUE self) {
|
|
1112
1112
|
* taken into account until the FrtIndexWriter has been committed.
|
1113
1113
|
*/
|
1114
1114
|
static VALUE
|
1115
|
-
frb_iw_get_doc_count(VALUE self)
|
1116
|
-
|
1115
|
+
frb_iw_get_doc_count(VALUE self) {
|
1116
|
+
int ex_code = 0;
|
1117
|
+
const char *msg = NULL;
|
1118
|
+
int cnt = 0;
|
1117
1119
|
FrtIndexWriter *iw = (FrtIndexWriter *)DATA_PTR(self);
|
1118
|
-
|
1120
|
+
|
1121
|
+
FRT_TRY
|
1122
|
+
cnt = frt_iw_doc_count(iw);
|
1123
|
+
FRT_XCATCHALL
|
1124
|
+
ex_code = xcontext.excode;
|
1125
|
+
msg = xcontext.msg;
|
1126
|
+
FRT_HANDLED();
|
1127
|
+
FRT_XENDTRY
|
1128
|
+
|
1129
|
+
if (ex_code && msg) {
|
1130
|
+
frb_raise(ex_code, msg);
|
1131
|
+
}
|
1132
|
+
|
1133
|
+
return INT2FIX(cnt);
|
1119
1134
|
}
|
1120
1135
|
|
1121
1136
|
static int
|
@@ -1224,12 +1239,26 @@ frb_get_doc(VALUE rdoc)
|
|
1224
1239
|
* hash object.
|
1225
1240
|
*/
|
1226
1241
|
static VALUE
|
1227
|
-
frb_iw_add_doc(VALUE self, VALUE rdoc)
|
1228
|
-
|
1242
|
+
frb_iw_add_doc(VALUE self, VALUE rdoc) {
|
1243
|
+
int ex_code = 0;
|
1244
|
+
const char *msg = NULL;
|
1245
|
+
|
1229
1246
|
FrtIndexWriter *iw = (FrtIndexWriter *)DATA_PTR(self);
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1247
|
+
|
1248
|
+
FRT_TRY
|
1249
|
+
FrtDocument *doc = frb_get_doc(rdoc);
|
1250
|
+
frt_iw_add_doc(iw, doc);
|
1251
|
+
frt_doc_destroy(doc);
|
1252
|
+
FRT_XCATCHALL
|
1253
|
+
ex_code = xcontext.excode;
|
1254
|
+
msg = xcontext.msg;
|
1255
|
+
FRT_HANDLED();
|
1256
|
+
FRT_XENDTRY
|
1257
|
+
|
1258
|
+
if (ex_code && msg) {
|
1259
|
+
frb_raise(ex_code, msg);
|
1260
|
+
}
|
1261
|
+
|
1233
1262
|
return self;
|
1234
1263
|
}
|
1235
1264
|
|
@@ -1246,10 +1275,24 @@ frb_iw_add_doc(VALUE self, VALUE rdoc)
|
|
1246
1275
|
* process).
|
1247
1276
|
*/
|
1248
1277
|
static VALUE
|
1249
|
-
frb_iw_optimize(VALUE self)
|
1250
|
-
|
1278
|
+
frb_iw_optimize(VALUE self) {
|
1279
|
+
int ex_code = 0;
|
1280
|
+
const char *msg = NULL;
|
1281
|
+
|
1251
1282
|
FrtIndexWriter *iw = (FrtIndexWriter *)DATA_PTR(self);
|
1252
|
-
|
1283
|
+
|
1284
|
+
FRT_TRY
|
1285
|
+
frt_iw_optimize(iw);
|
1286
|
+
FRT_XCATCHALL
|
1287
|
+
ex_code = xcontext.excode;
|
1288
|
+
msg = xcontext.msg;
|
1289
|
+
FRT_HANDLED();
|
1290
|
+
FRT_XENDTRY
|
1291
|
+
|
1292
|
+
if (ex_code && msg) {
|
1293
|
+
frb_raise(ex_code, msg);
|
1294
|
+
}
|
1295
|
+
|
1253
1296
|
return self;
|
1254
1297
|
}
|
1255
1298
|
|
@@ -1262,10 +1305,24 @@ frb_iw_optimize(VALUE self)
|
|
1262
1305
|
* with an IndexWriter.
|
1263
1306
|
*/
|
1264
1307
|
static VALUE
|
1265
|
-
frb_iw_commit(VALUE self)
|
1266
|
-
|
1308
|
+
frb_iw_commit(VALUE self) {
|
1309
|
+
int ex_code = 0;
|
1310
|
+
const char *msg = NULL;
|
1311
|
+
|
1267
1312
|
FrtIndexWriter *iw = (FrtIndexWriter *)DATA_PTR(self);
|
1268
|
-
|
1313
|
+
|
1314
|
+
FRT_TRY
|
1315
|
+
frt_iw_commit(iw);
|
1316
|
+
FRT_XCATCHALL
|
1317
|
+
ex_code = xcontext.excode;
|
1318
|
+
msg = xcontext.msg;
|
1319
|
+
FRT_HANDLED();
|
1320
|
+
FRT_XENDTRY
|
1321
|
+
|
1322
|
+
if (ex_code && msg) {
|
1323
|
+
frb_raise(ex_code, msg);
|
1324
|
+
}
|
1325
|
+
|
1269
1326
|
return self;
|
1270
1327
|
}
|
1271
1328
|
|
@@ -1322,21 +1379,36 @@ const rb_data_type_t frb_index_reader_t = {
|
|
1322
1379
|
* index.
|
1323
1380
|
*/
|
1324
1381
|
static VALUE frb_iw_add_readers(VALUE self, VALUE rreaders) {
|
1382
|
+
int ex_code = 0;
|
1383
|
+
const char *msg = NULL;
|
1325
1384
|
FrtIndexWriter *iw = (FrtIndexWriter *)DATA_PTR(self);
|
1326
|
-
int i;
|
1385
|
+
int i, l;
|
1327
1386
|
FrtIndexReader **irs;
|
1328
1387
|
Check_Type(rreaders, T_ARRAY);
|
1329
1388
|
|
1330
1389
|
irs = FRT_ALLOC_N(FrtIndexReader *, RARRAY_LEN(rreaders));
|
1331
|
-
i = RARRAY_LEN(rreaders);
|
1390
|
+
i = l = RARRAY_LEN(rreaders);
|
1332
1391
|
while (i-- > 0) {
|
1333
1392
|
FrtIndexReader *ir;
|
1334
1393
|
TypedData_Get_Struct(RARRAY_PTR(rreaders)[i], FrtIndexReader, &frb_index_reader_t, ir);
|
1335
1394
|
FRT_REF(ir);
|
1336
1395
|
irs[i] = ir;
|
1337
1396
|
}
|
1338
|
-
|
1397
|
+
|
1398
|
+
FRT_TRY
|
1399
|
+
frt_iw_add_readers(iw, irs, l);
|
1400
|
+
FRT_XCATCHALL
|
1401
|
+
ex_code = xcontext.excode;
|
1402
|
+
msg = xcontext.msg;
|
1403
|
+
FRT_HANDLED();
|
1404
|
+
FRT_XENDTRY
|
1405
|
+
|
1339
1406
|
free(irs);
|
1407
|
+
|
1408
|
+
if (ex_code && msg) {
|
1409
|
+
frb_raise(ex_code, msg);
|
1410
|
+
}
|
1411
|
+
|
1340
1412
|
return self;
|
1341
1413
|
}
|
1342
1414
|
|
@@ -1352,21 +1424,35 @@ static VALUE frb_iw_add_readers(VALUE self, VALUE rreaders) {
|
|
1352
1424
|
* want to delete all documents with the term "viagra" when deleting spam.
|
1353
1425
|
*/
|
1354
1426
|
static VALUE
|
1355
|
-
frb_iw_delete(VALUE self, VALUE rfield, VALUE rterm)
|
1356
|
-
|
1427
|
+
frb_iw_delete(VALUE self, VALUE rfield, VALUE rterm) {
|
1428
|
+
int ex_code = 0;
|
1429
|
+
const char *msg = NULL;
|
1430
|
+
|
1357
1431
|
FrtIndexWriter *iw = (FrtIndexWriter *)DATA_PTR(self);
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
terms
|
1432
|
+
|
1433
|
+
FRT_TRY
|
1434
|
+
if (TYPE(rterm) == T_ARRAY) {
|
1435
|
+
const int term_cnt = RARRAY_LEN(rterm);
|
1436
|
+
int i;
|
1437
|
+
char **terms = FRT_ALLOC_N(char *, term_cnt);
|
1438
|
+
for (i = 0; i < term_cnt; i++) {
|
1439
|
+
terms[i] = StringValuePtr(RARRAY_PTR(rterm)[i]);
|
1440
|
+
}
|
1441
|
+
frt_iw_delete_terms(iw, frb_field(rfield), terms, term_cnt);
|
1442
|
+
free(terms);
|
1443
|
+
} else {
|
1444
|
+
frt_iw_delete_term(iw, frb_field(rfield), StringValuePtr(rterm));
|
1364
1445
|
}
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1446
|
+
FRT_XCATCHALL
|
1447
|
+
ex_code = xcontext.excode;
|
1448
|
+
msg = xcontext.msg;
|
1449
|
+
FRT_HANDLED();
|
1450
|
+
FRT_XENDTRY
|
1451
|
+
|
1452
|
+
if (ex_code && msg) {
|
1453
|
+
frb_raise(ex_code, msg);
|
1369
1454
|
}
|
1455
|
+
|
1370
1456
|
return self;
|
1371
1457
|
}
|
1372
1458
|
|
@@ -1688,7 +1774,7 @@ frb_iw_set_use_compound_file(VALUE self, VALUE rval)
|
|
1688
1774
|
* dir = RAMDirectory.new()
|
1689
1775
|
* iw = IndexReader.new(dir)
|
1690
1776
|
*
|
1691
|
-
* dir =
|
1777
|
+
* dir = MDBXDirectory.new("/path/to/index")
|
1692
1778
|
* iw = IndexReader.new(dir)
|
1693
1779
|
*
|
1694
1780
|
* iw = IndexReader.new("/path/to/index")
|
@@ -1744,7 +1830,7 @@ static VALUE frb_ir_init(VALUE self, VALUE rdir) {
|
|
1744
1830
|
break;
|
1745
1831
|
case T_STRING:
|
1746
1832
|
frb_create_dir(rdir);
|
1747
|
-
store =
|
1833
|
+
store = frt_open_mdbx_store(rs2s(rdir));
|
1748
1834
|
break;
|
1749
1835
|
default:
|
1750
1836
|
FRT_RAISE(FRT_ARG_ERROR, "%s isn't a valid directory "
|
@@ -1765,7 +1851,7 @@ static VALUE frb_ir_init(VALUE self, VALUE rdir) {
|
|
1765
1851
|
break;
|
1766
1852
|
case T_STRING:
|
1767
1853
|
frb_create_dir(rdir);
|
1768
|
-
store =
|
1854
|
+
store = frt_open_mdbx_store(rs2s(rdir));
|
1769
1855
|
break;
|
1770
1856
|
default:
|
1771
1857
|
FRT_RAISE(FRT_ARG_ERROR, "%s isn't a valid directory argument. "
|
@@ -1810,10 +1896,23 @@ static VALUE frb_ir_init(VALUE self, VALUE rdir) {
|
|
1810
1896
|
* encoded float value.
|
1811
1897
|
*/
|
1812
1898
|
static VALUE
|
1813
|
-
frb_ir_set_norm(VALUE self, VALUE rdoc_id, VALUE rfield, VALUE rval)
|
1814
|
-
|
1899
|
+
frb_ir_set_norm(VALUE self, VALUE rdoc_id, VALUE rfield, VALUE rval) {
|
1900
|
+
int ex_code = 0;
|
1901
|
+
const char *msg = NULL;
|
1815
1902
|
FrtIndexReader *ir = (FrtIndexReader *)DATA_PTR(self);
|
1816
|
-
|
1903
|
+
|
1904
|
+
FRT_TRY
|
1905
|
+
frt_ir_set_norm(ir, FIX2INT(rdoc_id), frb_field(rfield), (frt_uchar)NUM2CHR(rval));
|
1906
|
+
FRT_XCATCHALL
|
1907
|
+
ex_code = xcontext.excode;
|
1908
|
+
msg = xcontext.msg;
|
1909
|
+
FRT_HANDLED();
|
1910
|
+
FRT_XENDTRY
|
1911
|
+
|
1912
|
+
if (ex_code && msg) {
|
1913
|
+
frb_raise(ex_code, msg);
|
1914
|
+
}
|
1915
|
+
|
1817
1916
|
return self;
|
1818
1917
|
}
|
1819
1918
|
|
@@ -1871,10 +1970,22 @@ frb_ir_get_norms_into(VALUE self, VALUE rfield, VALUE rnorms, VALUE roffset)
|
|
1871
1970
|
* will use open a Commit lock.
|
1872
1971
|
*/
|
1873
1972
|
static VALUE
|
1874
|
-
frb_ir_commit(VALUE self)
|
1875
|
-
|
1973
|
+
frb_ir_commit(VALUE self) {
|
1974
|
+
int ex_code = 0;
|
1975
|
+
const char *msg = NULL;
|
1876
1976
|
FrtIndexReader *ir = (FrtIndexReader *)DATA_PTR(self);
|
1877
|
-
|
1977
|
+
FRT_TRY
|
1978
|
+
frt_ir_commit(ir);
|
1979
|
+
FRT_XCATCHALL
|
1980
|
+
ex_code = xcontext.excode;
|
1981
|
+
msg = xcontext.msg;
|
1982
|
+
FRT_HANDLED();
|
1983
|
+
FRT_XENDTRY
|
1984
|
+
|
1985
|
+
if (ex_code && msg) {
|
1986
|
+
frb_raise(ex_code, msg);
|
1987
|
+
}
|
1988
|
+
|
1878
1989
|
return self;
|
1879
1990
|
}
|
1880
1991
|
|
@@ -1922,10 +2033,23 @@ frb_ir_has_deletions(VALUE self)
|
|
1922
2033
|
* returned by search methods.
|
1923
2034
|
*/
|
1924
2035
|
static VALUE
|
1925
|
-
frb_ir_delete(VALUE self, VALUE rdoc_id)
|
1926
|
-
|
2036
|
+
frb_ir_delete(VALUE self, VALUE rdoc_id) {
|
2037
|
+
int ex_code = 0;
|
2038
|
+
const char *msg = NULL;
|
1927
2039
|
FrtIndexReader *ir = (FrtIndexReader *)DATA_PTR(self);
|
1928
|
-
|
2040
|
+
|
2041
|
+
FRT_TRY
|
2042
|
+
frt_ir_delete_doc(ir, FIX2INT(rdoc_id));
|
2043
|
+
FRT_XCATCHALL
|
2044
|
+
ex_code = xcontext.excode;
|
2045
|
+
msg = xcontext.msg;
|
2046
|
+
FRT_HANDLED();
|
2047
|
+
FRT_XENDTRY
|
2048
|
+
|
2049
|
+
if (ex_code && msg) {
|
2050
|
+
frb_raise(ex_code, msg);
|
2051
|
+
}
|
2052
|
+
|
1929
2053
|
return self;
|
1930
2054
|
}
|
1931
2055
|
|
@@ -2014,8 +2138,7 @@ frb_get_doc_range(FrtIndexReader *ir, int pos, int len, int max)
|
|
2014
2138
|
* which are returned by the Searchers search methods.
|
2015
2139
|
*/
|
2016
2140
|
static VALUE
|
2017
|
-
frb_ir_get_doc(int argc, VALUE *argv, VALUE self)
|
2018
|
-
{
|
2141
|
+
frb_ir_get_doc(int argc, VALUE *argv, VALUE self) {
|
2019
2142
|
FrtIndexReader *ir = (FrtIndexReader *)DATA_PTR(self);
|
2020
2143
|
VALUE arg1, arg2;
|
2021
2144
|
long pos, len;
|
@@ -2044,8 +2167,7 @@ frb_ir_get_doc(int argc, VALUE *argv, VALUE self)
|
|
2044
2167
|
default:
|
2045
2168
|
return frb_get_doc_range(ir, pos, len, max);
|
2046
2169
|
}
|
2047
|
-
}
|
2048
|
-
else {
|
2170
|
+
} else {
|
2049
2171
|
pos = FIX2LONG(arg1);
|
2050
2172
|
len = FIX2LONG(arg2);
|
2051
2173
|
return frb_get_doc_range(ir, pos, len, max);
|
@@ -2811,10 +2933,6 @@ void Init_IndexReader(void) {
|
|
2811
2933
|
rb_define_method(cIndexReader, "to_enum", frb_ir_to_enum, 0);
|
2812
2934
|
}
|
2813
2935
|
|
2814
|
-
/* rdoc hack
|
2815
|
-
extern VALUE mFerret = rb_define_module("Ferret");
|
2816
|
-
*/
|
2817
|
-
|
2818
2936
|
/*
|
2819
2937
|
* Document-module: Ferret::Index
|
2820
2938
|
*
|
@@ -177,6 +177,7 @@ static VALUE frb_ld_lt(VALUE self, VALUE other) {
|
|
177
177
|
rLazyDoc *other_rld;
|
178
178
|
TypedData_Get_Struct(other, rLazyDoc, &frb_ld_t, other_rld);
|
179
179
|
other_h = frb_ld_to_h(other);
|
180
|
+
(void)other_rld;
|
180
181
|
}
|
181
182
|
VALUE self_h = frb_ld_to_h(self);
|
182
183
|
return rb_funcall(self_h, id_lt, 1, other_h);
|
@@ -190,6 +191,7 @@ static VALUE frb_ld_le(VALUE self, VALUE other) {
|
|
190
191
|
rLazyDoc *other_rld;
|
191
192
|
TypedData_Get_Struct(other, rLazyDoc, &frb_ld_t, other_rld);
|
192
193
|
other_h = frb_ld_to_h(other);
|
194
|
+
(void)other_rld;
|
193
195
|
}
|
194
196
|
VALUE self_h = frb_ld_to_h(self);
|
195
197
|
return rb_funcall(self_h, id_le, 1, other_h);
|
@@ -223,6 +225,7 @@ static VALUE frb_ld_gt(VALUE self, VALUE other) {
|
|
223
225
|
rLazyDoc *other_rld;
|
224
226
|
TypedData_Get_Struct(other, rLazyDoc, &frb_ld_t, other_rld);
|
225
227
|
other_h = frb_ld_to_h(other);
|
228
|
+
(void)other_rld;
|
226
229
|
}
|
227
230
|
VALUE self_h = frb_ld_to_h(self);
|
228
231
|
return rb_funcall(self_h, id_gt, 1, other_h);
|
@@ -236,6 +239,7 @@ static VALUE frb_ld_ge(VALUE self, VALUE other) {
|
|
236
239
|
rLazyDoc *other_rld;
|
237
240
|
TypedData_Get_Struct(other, rLazyDoc, &frb_ld_t, other_rld);
|
238
241
|
other_h = frb_ld_to_h(other);
|
242
|
+
(void)other_rld;
|
239
243
|
}
|
240
244
|
VALUE self_h = frb_ld_to_h(self);
|
241
245
|
return rb_funcall(self_h, id_ge, 1, other_h);
|
@@ -374,11 +374,6 @@ static VALUE frb_qp_set_tkz_fields(VALUE self, VALUE rfields) {
|
|
374
374
|
*
|
375
375
|
****************************************************************************/
|
376
376
|
|
377
|
-
/* rdoc hack
|
378
|
-
extern VALUE mFerret = rb_define_module("Ferret");
|
379
|
-
extern VALUE cQueryParser = rb_define_module_under(mFerret, "QueryParser");
|
380
|
-
*/
|
381
|
-
|
382
377
|
/*
|
383
378
|
* Document-class: Ferret::QueryParser::QueryParseException
|
384
379
|
*
|
@@ -410,7 +405,7 @@ void Init_QueryParseException(void) {
|
|
410
405
|
*
|
411
406
|
* If you want to use one of these characters in one of your terms you need
|
412
407
|
* to escape it with a \ character. \ escapes itself. The exception to this
|
413
|
-
* rule is within Phrases which
|
408
|
+
* rule is within Phrases which are strings surrounded by double quotes (and
|
414
409
|
* will be explained further bellow in the section on PhraseQueries). In
|
415
410
|
* Phrases, only ", | and <> have special meaning and need to be escaped if
|
416
411
|
* you want the literal value. <> is escaped \<\>.
|
@@ -3604,7 +3604,7 @@ static VALUE frb_sea_init(VALUE self, VALUE obj) {
|
|
3604
3604
|
FrtSearcher *sea;
|
3605
3605
|
if (TYPE(obj) == T_STRING) {
|
3606
3606
|
frb_create_dir(obj);
|
3607
|
-
store =
|
3607
|
+
store = frt_open_mdbx_store(rs2s(obj));
|
3608
3608
|
ir = frt_ir_open(NULL, store);
|
3609
3609
|
ir->rir = TypedData_Wrap_Struct(cIndexReader, &frb_index_reader_t, ir);
|
3610
3610
|
} else {
|
@@ -4593,11 +4593,6 @@ static void Init_SpanNotQuery(void) {
|
|
4593
4593
|
rb_define_method(cSpanNotQuery, "initialize", frb_spanxq_init, 2);
|
4594
4594
|
}
|
4595
4595
|
|
4596
|
-
/* rdoc hack
|
4597
|
-
extern VALUE mFerret = rb_define_module("Ferret");
|
4598
|
-
extern VALUE mSearch = rb_define_module_under(mFerret, "Search");
|
4599
|
-
*/
|
4600
|
-
|
4601
4596
|
/*
|
4602
4597
|
* Document-module: Ferret::Search::Spans
|
4603
4598
|
*
|