isomorfeus-ferret 0.13.8 → 0.13.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/isomorfeus_ferret_ext/bm_store.c +3 -3
- data/ext/isomorfeus_ferret_ext/bzlib.h +83 -82
- data/ext/isomorfeus_ferret_ext/frb_index.c +17 -23
- data/ext/isomorfeus_ferret_ext/frb_search.c +1 -4
- data/ext/isomorfeus_ferret_ext/frb_store.c +32 -34
- data/ext/isomorfeus_ferret_ext/frt_analysis.c +4 -4
- data/ext/isomorfeus_ferret_ext/frt_analysis.h +9 -9
- data/ext/isomorfeus_ferret_ext/frt_bitvector.c +1 -1
- data/ext/isomorfeus_ferret_ext/frt_bitvector.h +1 -1
- data/ext/isomorfeus_ferret_ext/frt_compound_io.c +41 -66
- data/ext/isomorfeus_ferret_ext/frt_config.h +8 -0
- data/ext/isomorfeus_ferret_ext/frt_except.c +1 -0
- data/ext/isomorfeus_ferret_ext/frt_filter.c +2 -4
- data/ext/isomorfeus_ferret_ext/frt_fs_store.c +24 -19
- data/ext/isomorfeus_ferret_ext/frt_global.c +6 -4
- data/ext/isomorfeus_ferret_ext/frt_global.h +1 -1
- data/ext/isomorfeus_ferret_ext/frt_hash.c +40 -48
- data/ext/isomorfeus_ferret_ext/frt_hash.h +14 -16
- data/ext/isomorfeus_ferret_ext/frt_hashset.c +5 -5
- data/ext/isomorfeus_ferret_ext/frt_ind.c +2 -3
- data/ext/isomorfeus_ferret_ext/frt_index.c +148 -219
- data/ext/isomorfeus_ferret_ext/frt_index.h +31 -31
- data/ext/isomorfeus_ferret_ext/frt_lang.c +1 -4
- data/ext/isomorfeus_ferret_ext/frt_multimapper.c +8 -9
- data/ext/isomorfeus_ferret_ext/frt_multimapper.h +1 -1
- data/ext/isomorfeus_ferret_ext/frt_q_boolean.c +6 -6
- data/ext/isomorfeus_ferret_ext/frt_q_match_all.c +8 -3
- data/ext/isomorfeus_ferret_ext/frt_q_parser.c +1743 -1742
- data/ext/isomorfeus_ferret_ext/frt_q_phrase.c +1 -2
- data/ext/isomorfeus_ferret_ext/frt_q_span.c +11 -10
- data/ext/isomorfeus_ferret_ext/frt_ram_store.c +24 -40
- data/ext/isomorfeus_ferret_ext/frt_search.c +29 -28
- data/ext/isomorfeus_ferret_ext/frt_search.h +18 -19
- data/ext/isomorfeus_ferret_ext/frt_store.c +47 -40
- data/ext/isomorfeus_ferret_ext/frt_store.h +46 -48
- data/ext/isomorfeus_ferret_ext/frt_threading.h +12 -5
- data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.c +4 -3
- data/ext/isomorfeus_ferret_ext/test_1710.c +1 -2
- data/ext/isomorfeus_ferret_ext/test_compound_io.c +8 -8
- data/ext/isomorfeus_ferret_ext/test_fields.c +7 -7
- data/ext/isomorfeus_ferret_ext/test_file_deleter.c +1 -1
- data/ext/isomorfeus_ferret_ext/test_filter.c +4 -3
- data/ext/isomorfeus_ferret_ext/test_fs_store.c +1 -1
- data/ext/isomorfeus_ferret_ext/test_highlighter.c +3 -1
- data/ext/isomorfeus_ferret_ext/test_index.c +61 -61
- data/ext/isomorfeus_ferret_ext/test_q_const_score.c +2 -1
- data/ext/isomorfeus_ferret_ext/test_q_filtered.c +3 -2
- data/ext/isomorfeus_ferret_ext/test_q_fuzzy.c +3 -1
- data/ext/isomorfeus_ferret_ext/test_q_span.c +8 -1
- data/ext/isomorfeus_ferret_ext/test_ram_store.c +4 -4
- data/ext/isomorfeus_ferret_ext/test_search.c +9 -4
- data/ext/isomorfeus_ferret_ext/test_segments.c +4 -3
- data/ext/isomorfeus_ferret_ext/test_sort.c +17 -9
- data/ext/isomorfeus_ferret_ext/test_term.c +4 -2
- data/ext/isomorfeus_ferret_ext/test_term_vectors.c +2 -2
- data/ext/isomorfeus_ferret_ext/test_threading.c +5 -4
- data/lib/isomorfeus/ferret/index/index.rb +8 -3
- data/lib/isomorfeus/ferret/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5603738325c11384e3dcd2d60e8ce34effbbe7b64fdcc319315910fdca6cbae
|
4
|
+
data.tar.gz: f15cc75761f2b0152243bbdc3983d880636fa71d6a2f5fdc4a34443fad28250b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ee5491226887aa837b0f71f053881c18be5dd460427aebf5501b17a3c863f9f28d4202848c82825ee110b568fb95a083e1defa4d1a316a6e7d9c35f41a328bc
|
7
|
+
data.tar.gz: 4e74d456a810c14b204e948c49885ef00710b2d79544ba5fc1c81c02bb1509459ad927935f9ef13fa73929d35919b18d4c5c56a4eb00790954da67f874fa591f
|
@@ -6,7 +6,7 @@
|
|
6
6
|
#define N 10
|
7
7
|
#define write_byte(os, b) os->buf.buf[os->buf.pos++] = (frt_uchar)b
|
8
8
|
|
9
|
-
void my_os_write_voff_t(FrtOutStream *os, register
|
9
|
+
void my_os_write_voff_t(FrtOutStream *os, register frt_off_t num) {
|
10
10
|
if (!(num&0x7f)) {
|
11
11
|
if (os->buf.pos >= FRT_BUFFER_SIZE) {
|
12
12
|
frt_os_write_byte(os, (frt_uchar)num);
|
@@ -48,7 +48,7 @@ void my_os_write_voff_t(FrtOutStream *os, register off_t num) {
|
|
48
48
|
|
49
49
|
static void vint_out(void) {
|
50
50
|
int n;
|
51
|
-
|
51
|
+
frt_off_t i;
|
52
52
|
FrtOutStream *os;
|
53
53
|
|
54
54
|
for (n = 0; n < N; n++) {
|
@@ -63,7 +63,7 @@ static void vint_out(void) {
|
|
63
63
|
|
64
64
|
static void unrolled_vint_out(void) {
|
65
65
|
int n;
|
66
|
-
|
66
|
+
frt_off_t i;
|
67
67
|
FrtOutStream *os;
|
68
68
|
|
69
69
|
for (n = 0; n < N; n++) {
|
@@ -11,7 +11,7 @@
|
|
11
11
|
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
12
12
|
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
13
13
|
|
14
|
-
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
14
|
+
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
15
15
|
README file.
|
16
16
|
|
17
17
|
This program is released under the terms of the license contained
|
@@ -25,6 +25,7 @@
|
|
25
25
|
#ifdef __cplusplus
|
26
26
|
extern "C" {
|
27
27
|
#endif
|
28
|
+
#define BZ_DEBUG 0
|
28
29
|
|
29
30
|
#define BZ_RUN 0
|
30
31
|
#define BZ_FLUSH 1
|
@@ -45,7 +46,7 @@ extern "C" {
|
|
45
46
|
#define BZ_OUTBUFF_FULL (-8)
|
46
47
|
#define BZ_CONFIG_ERROR (-9)
|
47
48
|
|
48
|
-
typedef
|
49
|
+
typedef
|
49
50
|
struct {
|
50
51
|
char *next_in;
|
51
52
|
unsigned int avail_in;
|
@@ -62,7 +63,7 @@ typedef
|
|
62
63
|
void *(*bzalloc)(void *,int,int);
|
63
64
|
void (*bzfree)(void *,void *);
|
64
65
|
void *opaque;
|
65
|
-
}
|
66
|
+
}
|
66
67
|
bz_stream;
|
67
68
|
|
68
69
|
|
@@ -97,34 +98,34 @@ typedef
|
|
97
98
|
|
98
99
|
/*-- Core (low-level) library functions --*/
|
99
100
|
|
100
|
-
BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
|
101
|
-
bz_stream* strm,
|
102
|
-
int blockSize100k,
|
103
|
-
int verbosity,
|
104
|
-
int workFactor
|
101
|
+
BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
|
102
|
+
bz_stream* strm,
|
103
|
+
int blockSize100k,
|
104
|
+
int verbosity,
|
105
|
+
int workFactor
|
105
106
|
);
|
106
107
|
|
107
|
-
BZ_EXTERN int BZ_API(BZ2_bzCompress) (
|
108
|
-
bz_stream* strm,
|
109
|
-
int action
|
108
|
+
BZ_EXTERN int BZ_API(BZ2_bzCompress) (
|
109
|
+
bz_stream* strm,
|
110
|
+
int action
|
110
111
|
);
|
111
112
|
|
112
|
-
BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
|
113
|
-
bz_stream* strm
|
113
|
+
BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
|
114
|
+
bz_stream* strm
|
114
115
|
);
|
115
116
|
|
116
|
-
BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
|
117
|
-
bz_stream *strm,
|
118
|
-
int verbosity,
|
117
|
+
BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
|
118
|
+
bz_stream *strm,
|
119
|
+
int verbosity,
|
119
120
|
int small
|
120
121
|
);
|
121
122
|
|
122
|
-
BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
|
123
|
-
bz_stream* strm
|
123
|
+
BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
|
124
|
+
bz_stream* strm
|
124
125
|
);
|
125
126
|
|
126
|
-
BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
|
127
|
-
bz_stream *strm
|
127
|
+
BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
|
128
|
+
bz_stream *strm
|
128
129
|
);
|
129
130
|
|
130
131
|
|
@@ -136,64 +137,64 @@ BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
|
|
136
137
|
|
137
138
|
typedef void BZFILE;
|
138
139
|
|
139
|
-
BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
|
140
|
-
int* bzerror,
|
141
|
-
FILE* f,
|
142
|
-
int verbosity,
|
140
|
+
BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
|
141
|
+
int* bzerror,
|
142
|
+
FILE* f,
|
143
|
+
int verbosity,
|
143
144
|
int small,
|
144
|
-
void* unused,
|
145
|
-
int nUnused
|
145
|
+
void* unused,
|
146
|
+
int nUnused
|
146
147
|
);
|
147
148
|
|
148
|
-
BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
|
149
|
-
int* bzerror,
|
150
|
-
BZFILE* b
|
149
|
+
BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
|
150
|
+
int* bzerror,
|
151
|
+
BZFILE* b
|
151
152
|
);
|
152
153
|
|
153
|
-
BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
|
154
|
-
int* bzerror,
|
155
|
-
BZFILE* b,
|
156
|
-
void** unused,
|
157
|
-
int* nUnused
|
154
|
+
BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
|
155
|
+
int* bzerror,
|
156
|
+
BZFILE* b,
|
157
|
+
void** unused,
|
158
|
+
int* nUnused
|
158
159
|
);
|
159
160
|
|
160
|
-
BZ_EXTERN int BZ_API(BZ2_bzRead) (
|
161
|
-
int* bzerror,
|
162
|
-
BZFILE* b,
|
163
|
-
void* buf,
|
164
|
-
int len
|
161
|
+
BZ_EXTERN int BZ_API(BZ2_bzRead) (
|
162
|
+
int* bzerror,
|
163
|
+
BZFILE* b,
|
164
|
+
void* buf,
|
165
|
+
int len
|
165
166
|
);
|
166
167
|
|
167
|
-
BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
|
168
|
-
int* bzerror,
|
169
|
-
FILE* f,
|
170
|
-
int blockSize100k,
|
171
|
-
int verbosity,
|
172
|
-
int workFactor
|
168
|
+
BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
|
169
|
+
int* bzerror,
|
170
|
+
FILE* f,
|
171
|
+
int blockSize100k,
|
172
|
+
int verbosity,
|
173
|
+
int workFactor
|
173
174
|
);
|
174
175
|
|
175
|
-
BZ_EXTERN void BZ_API(BZ2_bzWrite) (
|
176
|
-
int* bzerror,
|
177
|
-
BZFILE* b,
|
178
|
-
void* buf,
|
179
|
-
int len
|
176
|
+
BZ_EXTERN void BZ_API(BZ2_bzWrite) (
|
177
|
+
int* bzerror,
|
178
|
+
BZFILE* b,
|
179
|
+
void* buf,
|
180
|
+
int len
|
180
181
|
);
|
181
182
|
|
182
|
-
BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
|
183
|
-
int* bzerror,
|
184
|
-
BZFILE* b,
|
185
|
-
int abandon,
|
186
|
-
unsigned int* nbytes_in,
|
187
|
-
unsigned int* nbytes_out
|
183
|
+
BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
|
184
|
+
int* bzerror,
|
185
|
+
BZFILE* b,
|
186
|
+
int abandon,
|
187
|
+
unsigned int* nbytes_in,
|
188
|
+
unsigned int* nbytes_out
|
188
189
|
);
|
189
190
|
|
190
|
-
BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
|
191
|
-
int* bzerror,
|
192
|
-
BZFILE* b,
|
193
|
-
int abandon,
|
194
|
-
unsigned int* nbytes_in_lo32,
|
195
|
-
unsigned int* nbytes_in_hi32,
|
196
|
-
unsigned int* nbytes_out_lo32,
|
191
|
+
BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
|
192
|
+
int* bzerror,
|
193
|
+
BZFILE* b,
|
194
|
+
int abandon,
|
195
|
+
unsigned int* nbytes_in_lo32,
|
196
|
+
unsigned int* nbytes_in_hi32,
|
197
|
+
unsigned int* nbytes_out_lo32,
|
197
198
|
unsigned int* nbytes_out_hi32
|
198
199
|
);
|
199
200
|
#endif
|
@@ -201,23 +202,23 @@ BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
|
|
201
202
|
|
202
203
|
/*-- Utility functions --*/
|
203
204
|
|
204
|
-
BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
|
205
|
-
char* dest,
|
205
|
+
BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
|
206
|
+
char* dest,
|
206
207
|
unsigned int* destLen,
|
207
|
-
char* source,
|
208
|
+
char* source,
|
208
209
|
unsigned int sourceLen,
|
209
|
-
int blockSize100k,
|
210
|
-
int verbosity,
|
211
|
-
int workFactor
|
210
|
+
int blockSize100k,
|
211
|
+
int verbosity,
|
212
|
+
int workFactor
|
212
213
|
);
|
213
214
|
|
214
|
-
BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
|
215
|
-
char* dest,
|
215
|
+
BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
|
216
|
+
char* dest,
|
216
217
|
unsigned int* destLen,
|
217
|
-
char* source,
|
218
|
+
char* source,
|
218
219
|
unsigned int sourceLen,
|
219
|
-
int small,
|
220
|
-
int verbosity
|
220
|
+
int small,
|
221
|
+
int verbosity
|
221
222
|
);
|
222
223
|
|
223
224
|
|
@@ -244,17 +245,17 @@ BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
|
|
244
245
|
int fd,
|
245
246
|
const char *mode
|
246
247
|
);
|
247
|
-
|
248
|
+
|
248
249
|
BZ_EXTERN int BZ_API(BZ2_bzread) (
|
249
|
-
BZFILE* b,
|
250
|
-
void* buf,
|
251
|
-
int len
|
250
|
+
BZFILE* b,
|
251
|
+
void* buf,
|
252
|
+
int len
|
252
253
|
);
|
253
254
|
|
254
255
|
BZ_EXTERN int BZ_API(BZ2_bzwrite) (
|
255
|
-
BZFILE* b,
|
256
|
-
void* buf,
|
257
|
-
int len
|
256
|
+
BZFILE* b,
|
257
|
+
void* buf,
|
258
|
+
int len
|
258
259
|
);
|
259
260
|
|
260
261
|
BZ_EXTERN int BZ_API(BZ2_bzflush) (
|
@@ -266,7 +267,7 @@ BZ_EXTERN void BZ_API(BZ2_bzclose) (
|
|
266
267
|
);
|
267
268
|
|
268
269
|
BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
|
269
|
-
BZFILE *b,
|
270
|
+
BZFILE *b,
|
270
271
|
int *errnum
|
271
272
|
);
|
272
273
|
#endif
|
@@ -229,7 +229,7 @@ static VALUE frb_fi_init(int argc, VALUE *argv, VALUE self) {
|
|
229
229
|
*/
|
230
230
|
static VALUE frb_fi_name(VALUE self) {
|
231
231
|
FrtFieldInfo *fi = (FrtFieldInfo *)DATA_PTR(self);
|
232
|
-
return
|
232
|
+
return ID2SYM(fi->name);
|
233
233
|
}
|
234
234
|
|
235
235
|
/*
|
@@ -536,7 +536,7 @@ frb_fis_add_field(int argc, VALUE *argv, VALUE self)
|
|
536
536
|
{
|
537
537
|
FrtFieldInfos *fis = (FrtFieldInfos *)DATA_PTR(self);
|
538
538
|
FrtFieldInfo *fi;
|
539
|
-
FrtStoreValue
|
539
|
+
FrtStoreValue store_val = fis->store_val;
|
540
540
|
FrtCompressionType compression = fis->compression;
|
541
541
|
FrtIndexValue index = fis->index;
|
542
542
|
FrtTermVectorValue term_vector = fis->term_vector;
|
@@ -545,9 +545,9 @@ frb_fis_add_field(int argc, VALUE *argv, VALUE self)
|
|
545
545
|
|
546
546
|
rb_scan_args(argc, argv, "11", &rname, &roptions);
|
547
547
|
if (argc > 1) {
|
548
|
-
frb_fi_get_params(roptions, &
|
548
|
+
frb_fi_get_params(roptions, &store_val, &compression, &index, &term_vector, &boost);
|
549
549
|
}
|
550
|
-
fi = frt_fi_new(frb_field(rname),
|
550
|
+
fi = frt_fi_new(frb_field(rname), store_val, compression, index, term_vector);
|
551
551
|
fi->boost = boost;
|
552
552
|
frt_fis_add_field(fis, fi);
|
553
553
|
return self;
|
@@ -593,9 +593,7 @@ frb_fis_to_s(VALUE self)
|
|
593
593
|
*
|
594
594
|
* Return the number of fields in the FieldInfos object.
|
595
595
|
*/
|
596
|
-
static VALUE
|
597
|
-
frb_fis_size(VALUE self)
|
598
|
-
{
|
596
|
+
static VALUE frb_fis_size(VALUE self) {
|
599
597
|
FrtFieldInfos *fis = (FrtFieldInfos *)DATA_PTR(self);
|
600
598
|
return INT2FIX(fis->size);
|
601
599
|
}
|
@@ -610,21 +608,19 @@ frb_fis_size(VALUE self)
|
|
610
608
|
* existing index (or other files for that matter) will be deleted from the
|
611
609
|
* directory and overwritten by the new index.
|
612
610
|
*/
|
613
|
-
static VALUE
|
614
|
-
frb_fis_create_index(VALUE self, VALUE rdir)
|
615
|
-
{
|
611
|
+
static VALUE frb_fis_create_index(VALUE self, VALUE rdir) {
|
616
612
|
FrtFieldInfos *fis = (FrtFieldInfos *)DATA_PTR(self);
|
617
613
|
FrtStore *store = NULL;
|
618
614
|
if (TYPE(rdir) == T_DATA) {
|
619
615
|
store = DATA_PTR(rdir);
|
620
|
-
|
616
|
+
frt_index_create(store, fis);
|
621
617
|
} else {
|
622
618
|
StringValue(rdir);
|
623
619
|
frb_create_dir(rdir);
|
624
620
|
store = frt_open_fs_store(rs2s(rdir));
|
621
|
+
frt_index_create(store, fis);
|
622
|
+
frt_store_close(store);
|
625
623
|
}
|
626
|
-
frt_index_create(store, fis);
|
627
|
-
frt_store_deref(store);
|
628
624
|
return self;
|
629
625
|
}
|
630
626
|
|
@@ -663,7 +659,7 @@ frb_fis_get_tk_fields(VALUE self)
|
|
663
659
|
int i;
|
664
660
|
for (i = 0; i < fis->size; i++) {
|
665
661
|
if (!fi_is_tokenized(fis->fields[i])) continue;
|
666
|
-
rb_ary_push(rfield_names,
|
662
|
+
rb_ary_push(rfield_names, ID2SYM(fis->fields[i]->name));
|
667
663
|
}
|
668
664
|
return rfield_names;
|
669
665
|
}
|
@@ -1344,6 +1340,8 @@ static VALUE frb_iw_alloc(VALUE rclass) {
|
|
1344
1340
|
return TypedData_Wrap_Struct(rclass, &frb_index_writer_t, iw);
|
1345
1341
|
}
|
1346
1342
|
|
1343
|
+
extern rb_data_type_t frb_store_t;
|
1344
|
+
|
1347
1345
|
static VALUE frb_iw_init(int argc, VALUE *argv, VALUE self) {
|
1348
1346
|
VALUE roptions, rval;
|
1349
1347
|
bool create = false;
|
@@ -1363,12 +1361,11 @@ static VALUE frb_iw_init(int argc, VALUE *argv, VALUE self) {
|
|
1363
1361
|
|
1364
1362
|
if ((rval = rb_hash_aref(roptions, sym_dir)) != Qnil) {
|
1365
1363
|
// Check_Type(rval, T_DATA);
|
1366
|
-
|
1364
|
+
TypedData_Get_Struct(rval, FrtStore, &frb_store_t, store);
|
1367
1365
|
} else if ((rval = rb_hash_aref(roptions, sym_path)) != Qnil) {
|
1368
1366
|
StringValue(rval);
|
1369
1367
|
frb_create_dir(rval);
|
1370
1368
|
store = frt_open_fs_store(rs2s(rval));
|
1371
|
-
FRT_DEREF(store);
|
1372
1369
|
}
|
1373
1370
|
/* use_compound_file defaults to true */
|
1374
1371
|
config.use_compound_file =
|
@@ -1393,7 +1390,6 @@ static VALUE frb_iw_init(int argc, VALUE *argv, VALUE self) {
|
|
1393
1390
|
}
|
1394
1391
|
if (NULL == store) {
|
1395
1392
|
store = frt_open_ram_store(NULL);
|
1396
|
-
FRT_DEREF(store);
|
1397
1393
|
}
|
1398
1394
|
if (!create && create_if_missing && !store->exists(store, "segments")) {
|
1399
1395
|
create = true;
|
@@ -1411,7 +1407,7 @@ static VALUE frb_iw_init(int argc, VALUE *argv, VALUE self) {
|
|
1411
1407
|
}
|
1412
1408
|
|
1413
1409
|
TypedData_Get_Struct(self, FrtIndexWriter, &frb_index_writer_t, iw);
|
1414
|
-
|
1410
|
+
frt_iw_open(iw, store, analyzer, &config);
|
1415
1411
|
FRT_XCATCHALL
|
1416
1412
|
ex_code = xcontext.excode;
|
1417
1413
|
msg = xcontext.msg;
|
@@ -1598,9 +1594,9 @@ void frb_ir_free(void *p) {
|
|
1598
1594
|
|
1599
1595
|
void frb_ir_mark(void *p) {
|
1600
1596
|
FrtIndexReader *ir = (FrtIndexReader *)p;
|
1601
|
-
FrtMultiReader *mr = (FrtMultiReader *)p;
|
1602
1597
|
|
1603
1598
|
if (ir->type == FRT_MULTI_READER) {
|
1599
|
+
FrtMultiReader *mr = (FrtMultiReader *)p;
|
1604
1600
|
int i;
|
1605
1601
|
for (i = 0; i < mr->r_cnt; i++) {
|
1606
1602
|
if (mr->sub_readers[i]->rir)
|
@@ -1652,6 +1648,7 @@ static VALUE frb_iw_add_readers(VALUE self, VALUE rreaders) {
|
|
1652
1648
|
while (i-- > 0) {
|
1653
1649
|
FrtIndexReader *ir;
|
1654
1650
|
TypedData_Get_Struct(RARRAY_PTR(rreaders)[i], FrtIndexReader, &frb_index_reader_t, ir);
|
1651
|
+
FRT_REF(ir);
|
1655
1652
|
irs[i] = ir;
|
1656
1653
|
}
|
1657
1654
|
frt_iw_add_readers(iw, irs, RARRAY_LEN(rreaders));
|
@@ -2157,7 +2154,6 @@ static VALUE frb_ir_init(VALUE self, VALUE rdir) {
|
|
2157
2154
|
VALUE rfield_num_map = rb_hash_new();
|
2158
2155
|
int ex_code = 0;
|
2159
2156
|
const char *msg = NULL;
|
2160
|
-
|
2161
2157
|
FRT_TRY
|
2162
2158
|
if (TYPE(rdir) == T_ARRAY) {
|
2163
2159
|
VALUE rdirs = rdir;
|
@@ -2170,7 +2166,6 @@ static VALUE frb_ir_init(VALUE self, VALUE rdir) {
|
|
2170
2166
|
case T_DATA:
|
2171
2167
|
if (CLASS_OF(rdir) == cIndexReader) {
|
2172
2168
|
TypedData_Get_Struct(rdir, FrtIndexReader, &frb_index_reader_t, sub_readers[i]);
|
2173
|
-
FRT_REF(sub_readers[i]);
|
2174
2169
|
continue;
|
2175
2170
|
} else if (RTEST(rb_obj_is_kind_of(rdir, cDirectory))) {
|
2176
2171
|
store = DATA_PTR(rdir);
|
@@ -2185,7 +2180,6 @@ static VALUE frb_ir_init(VALUE self, VALUE rdir) {
|
|
2185
2180
|
case T_STRING:
|
2186
2181
|
frb_create_dir(rdir);
|
2187
2182
|
store = frt_open_fs_store(rs2s(rdir));
|
2188
|
-
FRT_DEREF(store);
|
2189
2183
|
break;
|
2190
2184
|
default:
|
2191
2185
|
FRT_RAISE(FRT_ARG_ERROR, "%s isn't a valid directory "
|
@@ -2195,6 +2189,7 @@ static VALUE frb_ir_init(VALUE self, VALUE rdir) {
|
|
2195
2189
|
break;
|
2196
2190
|
}
|
2197
2191
|
sub_readers[i] = frt_ir_open(NULL, store);
|
2192
|
+
FRT_DEREF(sub_readers[i]);
|
2198
2193
|
}
|
2199
2194
|
TypedData_Get_Struct(self, FrtIndexReader, &frb_index_reader_t, ir);
|
2200
2195
|
ir = frt_mr_open(ir, sub_readers, reader_cnt);
|
@@ -2206,7 +2201,6 @@ static VALUE frb_ir_init(VALUE self, VALUE rdir) {
|
|
2206
2201
|
case T_STRING:
|
2207
2202
|
frb_create_dir(rdir);
|
2208
2203
|
store = frt_open_fs_store(rs2s(rdir));
|
2209
|
-
FRT_DEREF(store);
|
2210
2204
|
break;
|
2211
2205
|
default:
|
2212
2206
|
FRT_RAISE(FRT_ARG_ERROR, "%s isn't a valid directory argument. "
|
@@ -3606,7 +3606,6 @@ static VALUE frb_sea_init(VALUE self, VALUE obj) {
|
|
3606
3606
|
frb_create_dir(obj);
|
3607
3607
|
store = frt_open_fs_store(rs2s(obj));
|
3608
3608
|
ir = frt_ir_open(NULL, store);
|
3609
|
-
FRT_DEREF(store);
|
3610
3609
|
ir->rir = TypedData_Wrap_Struct(cIndexReader, &frb_index_reader_t, ir);
|
3611
3610
|
} else {
|
3612
3611
|
// Check_Type(obj, T_DATA);
|
@@ -3616,14 +3615,12 @@ static VALUE frb_sea_init(VALUE self, VALUE obj) {
|
|
3616
3615
|
ir->rir = TypedData_Wrap_Struct(cIndexReader, &frb_index_reader_t, ir);
|
3617
3616
|
} else if (rb_obj_is_kind_of(obj, cIndexReader) == Qtrue) {
|
3618
3617
|
TypedData_Get_Struct(obj, FrtIndexReader, &frb_index_reader_t, ir);
|
3619
|
-
ir->rir = obj;
|
3620
3618
|
} else {
|
3621
3619
|
rb_raise(rb_eArgError, "Unknown type for argument to IndexSearcher.new");
|
3622
3620
|
}
|
3623
3621
|
}
|
3624
3622
|
TypedData_Get_Struct(self, FrtSearcher, &frb_index_searcher_t, sea);
|
3625
3623
|
frt_isea_init(sea, ir);
|
3626
|
-
((FrtIndexSearcher *)sea)->close_ir = false;
|
3627
3624
|
sea->rsea = self;
|
3628
3625
|
return self;
|
3629
3626
|
}
|
@@ -3710,7 +3707,7 @@ static VALUE frb_ms_init(int argc, VALUE *argv, VALUE self) {
|
|
3710
3707
|
}
|
3711
3708
|
}
|
3712
3709
|
TypedData_Get_Struct(self, FrtSearcher, &frb_multi_searcher_t, sea);
|
3713
|
-
frt_msea_init(sea, searchers, top
|
3710
|
+
frt_msea_init(sea, searchers, top);
|
3714
3711
|
sea->rsea = self;
|
3715
3712
|
return self;
|
3716
3713
|
}
|
@@ -185,10 +185,35 @@ static VALUE frb_lock_release(VALUE self) {
|
|
185
185
|
*
|
186
186
|
****************************************************************************/
|
187
187
|
|
188
|
+
/*** FrbStore ****************************************************************/
|
189
|
+
|
190
|
+
static size_t frb_store_size(const void *p) {
|
191
|
+
return sizeof(FrtStore);
|
192
|
+
(void)p;
|
193
|
+
}
|
194
|
+
|
188
195
|
void frb_dir_free(void *p) {
|
189
|
-
|
190
|
-
|
191
|
-
|
196
|
+
frb_unwrap_locks((FrtStore *)p);
|
197
|
+
frt_store_close((FrtStore *)p);
|
198
|
+
}
|
199
|
+
|
200
|
+
const rb_data_type_t frb_store_t = {
|
201
|
+
.wrap_struct_name = "FrbStore",
|
202
|
+
.function = {
|
203
|
+
.dmark = NULL,
|
204
|
+
.dfree = frb_dir_free,
|
205
|
+
.dsize = frb_store_size,
|
206
|
+
.dcompact = NULL,
|
207
|
+
.reserved = {0},
|
208
|
+
},
|
209
|
+
.parent = NULL,
|
210
|
+
.data = NULL,
|
211
|
+
.flags = RUBY_TYPED_FREE_IMMEDIATELY
|
212
|
+
};
|
213
|
+
|
214
|
+
static VALUE frb_store_alloc(VALUE rclass) {
|
215
|
+
FrtStore *st = frt_store_alloc();
|
216
|
+
return TypedData_Wrap_Struct(rclass, &frb_store_t, st);
|
192
217
|
}
|
193
218
|
|
194
219
|
/*
|
@@ -208,7 +233,7 @@ static VALUE frb_dir_close(VALUE self) {
|
|
208
233
|
((struct RData *)(self))->dmark = NULL;
|
209
234
|
((struct RData *)(self))->dfree = NULL;
|
210
235
|
frb_unwrap_locks(store);
|
211
|
-
|
236
|
+
frt_store_close(store);
|
212
237
|
}
|
213
238
|
return Qnil;
|
214
239
|
}
|
@@ -308,32 +333,6 @@ static VALUE frb_dir_make_lock(VALUE self, VALUE rlock_name) {
|
|
308
333
|
return rlock;
|
309
334
|
}
|
310
335
|
|
311
|
-
/*** FrbStore ****************************************************************/
|
312
|
-
|
313
|
-
static size_t frb_store_size(const void *p) {
|
314
|
-
return sizeof(FrtStore);
|
315
|
-
(void)p;
|
316
|
-
}
|
317
|
-
|
318
|
-
const rb_data_type_t frb_store_t = {
|
319
|
-
.wrap_struct_name = "FrbStore",
|
320
|
-
.function = {
|
321
|
-
.dmark = NULL,
|
322
|
-
.dfree = frb_dir_free,
|
323
|
-
.dsize = frb_store_size,
|
324
|
-
.dcompact = NULL,
|
325
|
-
.reserved = {0},
|
326
|
-
},
|
327
|
-
.parent = NULL,
|
328
|
-
.data = NULL,
|
329
|
-
.flags = RUBY_TYPED_FREE_IMMEDIATELY
|
330
|
-
};
|
331
|
-
|
332
|
-
static VALUE frb_store_alloc(VALUE rclass) {
|
333
|
-
FrtStore *st = frt_store_alloc();
|
334
|
-
return TypedData_Wrap_Struct(rclass, &frb_store_t, st);
|
335
|
-
}
|
336
|
-
|
337
336
|
/****************************************************************************
|
338
337
|
*
|
339
338
|
* RAMDirectory Methods
|
@@ -403,19 +402,18 @@ static VALUE frb_fsdir_new(int argc, VALUE *argv, VALUE klass) {
|
|
403
402
|
frb_create_dir(rpath);
|
404
403
|
}
|
405
404
|
if (!rb_funcall(rb_cFile, id_is_directory, 1, rpath)) {
|
406
|
-
rb_raise(rb_eIOError, "No directory <%s> found. Use :create => true"
|
407
|
-
" to create one.", rs2s(rpath));
|
405
|
+
rb_raise(rb_eIOError, "No directory <%s> found. Use :create => true to create one.", rs2s(rpath));
|
408
406
|
}
|
409
407
|
store = frt_open_fs_store(rs2s(rpath));
|
410
408
|
if (create) store->clear_all(store);
|
411
|
-
|
409
|
+
self = store->rstore;
|
410
|
+
if (self == Qnil || DATA_PTR(self) == NULL) {
|
412
411
|
self = TypedData_Wrap_Struct(klass, &frb_store_t, store);
|
413
412
|
store->rstore = self;
|
414
413
|
rb_ivar_set(self, id_ref_cnt, INT2FIX(0));
|
415
414
|
} else {
|
416
415
|
int ref_cnt = FIX2INT(rb_ivar_get(self, id_ref_cnt)) + 1;
|
417
416
|
rb_ivar_set(self, id_ref_cnt, INT2FIX(ref_cnt));
|
418
|
-
FRT_DEREF(store);
|
419
417
|
}
|
420
418
|
return self;
|
421
419
|
}
|
@@ -64,7 +64,7 @@ static inline int get_cp(char *start, char *end, int *cp_len, rb_encoding *enc)
|
|
64
64
|
/*** FrtToken ****************************************************************/
|
65
65
|
/*****************************************************************************/
|
66
66
|
|
67
|
-
FrtToken *frt_tk_set(FrtToken *tk, char *text, int tlen,
|
67
|
+
FrtToken *frt_tk_set(FrtToken *tk, char *text, int tlen, frt_off_t start, frt_off_t end, int pos_inc, rb_encoding *encoding) {
|
68
68
|
if (tlen >= FRT_MAX_WORD_SIZE) {
|
69
69
|
tlen = FRT_MAX_WORD_SIZE - 1; // TODO: this may invalidate mbc's
|
70
70
|
}
|
@@ -92,7 +92,7 @@ static FrtToken *frt_tk_set_ts(FrtToken *tk, char *start, char *end, char *text,
|
|
92
92
|
return frt_tk_set(tk, start, (int)(end - start), (off_t)(start - text), (off_t)(end - text), pos_inc, encoding);
|
93
93
|
}
|
94
94
|
|
95
|
-
FrtToken *frt_tk_set_no_len(FrtToken *tk, char *text,
|
95
|
+
FrtToken *frt_tk_set_no_len(FrtToken *tk, char *text, frt_off_t start, frt_off_t end, int pos_inc, rb_encoding *encoding) {
|
96
96
|
return frt_tk_set(tk, text, (int)strlen(text), start, end, pos_inc, encoding);
|
97
97
|
}
|
98
98
|
|
@@ -133,7 +133,7 @@ FrtToken *frt_tk_new(void) {
|
|
133
133
|
/*****************************************************************************/
|
134
134
|
|
135
135
|
void frt_ts_deref(FrtTokenStream *ts) {
|
136
|
-
if (
|
136
|
+
if (FRT_DEREF(ts) == 0)
|
137
137
|
ts->destroy_i(ts);
|
138
138
|
}
|
139
139
|
|
@@ -1089,7 +1089,7 @@ FrtTokenStream *frt_stem_filter_new(FrtTokenStream *sub_ts, const char *algorith
|
|
1089
1089
|
/*****************************************************************************/
|
1090
1090
|
|
1091
1091
|
void frt_a_deref(FrtAnalyzer *a) {
|
1092
|
-
if (
|
1092
|
+
if (FRT_DEREF(a) == 0)
|
1093
1093
|
a->destroy_i(a);
|
1094
1094
|
}
|
1095
1095
|
|