isomorfeus-ferret 0.17.2 → 0.17.3
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/benchmark.c +9 -20
- data/ext/isomorfeus_ferret_ext/benchmarks_all.h +1 -2
- data/ext/isomorfeus_ferret_ext/bm_hash.c +1 -2
- data/ext/isomorfeus_ferret_ext/brotli_dec_decode.c +4 -2
- data/ext/isomorfeus_ferret_ext/brotli_enc_encode.c +3 -2
- data/ext/isomorfeus_ferret_ext/frb_analysis.c +4 -5
- data/ext/isomorfeus_ferret_ext/frb_field_info.c +3 -4
- data/ext/isomorfeus_ferret_ext/frb_index.c +118 -125
- data/ext/isomorfeus_ferret_ext/frb_lazy_doc.c +14 -16
- data/ext/isomorfeus_ferret_ext/frb_search.c +31 -23
- data/ext/isomorfeus_ferret_ext/frb_store.c +27 -13
- data/ext/isomorfeus_ferret_ext/frb_utils.c +3 -6
- data/ext/isomorfeus_ferret_ext/frt_analysis.c +39 -46
- data/ext/isomorfeus_ferret_ext/frt_analysis.h +9 -9
- data/ext/isomorfeus_ferret_ext/frt_array.c +11 -22
- data/ext/isomorfeus_ferret_ext/frt_bitvector.h +3 -6
- data/ext/isomorfeus_ferret_ext/frt_doc_field.c +87 -0
- data/ext/isomorfeus_ferret_ext/frt_doc_field.h +26 -0
- data/ext/isomorfeus_ferret_ext/frt_document.c +4 -97
- data/ext/isomorfeus_ferret_ext/frt_document.h +2 -27
- data/ext/isomorfeus_ferret_ext/frt_except.c +8 -6
- data/ext/isomorfeus_ferret_ext/frt_except.h +1 -2
- data/ext/isomorfeus_ferret_ext/frt_field_index.c +13 -32
- data/ext/isomorfeus_ferret_ext/frt_field_index.h +0 -6
- data/ext/isomorfeus_ferret_ext/frt_field_info.c +69 -0
- data/ext/isomorfeus_ferret_ext/frt_field_info.h +49 -0
- data/ext/isomorfeus_ferret_ext/frt_field_infos.c +196 -0
- data/ext/isomorfeus_ferret_ext/frt_field_infos.h +35 -0
- data/ext/isomorfeus_ferret_ext/frt_global.c +10 -4
- data/ext/isomorfeus_ferret_ext/frt_global.h +11 -15
- data/ext/isomorfeus_ferret_ext/frt_hash.c +8 -8
- data/ext/isomorfeus_ferret_ext/frt_hash.h +1 -2
- data/ext/isomorfeus_ferret_ext/frt_hashset.c +20 -40
- data/ext/isomorfeus_ferret_ext/frt_hashset.h +1 -2
- data/ext/isomorfeus_ferret_ext/frt_helper.c +7 -15
- data/ext/isomorfeus_ferret_ext/frt_in_stream.c +35 -45
- data/ext/isomorfeus_ferret_ext/frt_in_stream.h +3 -2
- data/ext/isomorfeus_ferret_ext/frt_ind.c +20 -38
- data/ext/isomorfeus_ferret_ext/frt_index.c +292 -790
- data/ext/isomorfeus_ferret_ext/frt_index.h +1 -102
- data/ext/isomorfeus_ferret_ext/frt_lang.c +5 -10
- data/ext/isomorfeus_ferret_ext/frt_lazy_doc.c +3 -3
- data/ext/isomorfeus_ferret_ext/frt_lazy_doc.h +1 -1
- data/ext/isomorfeus_ferret_ext/frt_lazy_doc_field.c +18 -25
- data/ext/isomorfeus_ferret_ext/frt_lazy_doc_field.h +5 -5
- data/ext/isomorfeus_ferret_ext/frt_mdbx_store.c +102 -70
- data/ext/isomorfeus_ferret_ext/frt_mempool.c +8 -16
- data/ext/isomorfeus_ferret_ext/frt_multimapper.c +23 -46
- data/ext/isomorfeus_ferret_ext/frt_multimapper.h +4 -8
- data/ext/isomorfeus_ferret_ext/frt_out_stream.c +31 -43
- data/ext/isomorfeus_ferret_ext/frt_out_stream.h +2 -2
- data/ext/isomorfeus_ferret_ext/frt_posh.c +6 -819
- data/ext/isomorfeus_ferret_ext/frt_posh.h +0 -57
- data/ext/isomorfeus_ferret_ext/frt_priorityqueue.c +11 -22
- data/ext/isomorfeus_ferret_ext/frt_priorityqueue.h +1 -2
- data/ext/isomorfeus_ferret_ext/frt_q_boolean.c +85 -171
- data/ext/isomorfeus_ferret_ext/frt_q_match_all.c +8 -16
- data/ext/isomorfeus_ferret_ext/frt_q_multi_term.c +1 -2
- data/ext/isomorfeus_ferret_ext/frt_q_parser.c +49 -98
- data/ext/isomorfeus_ferret_ext/frt_q_phrase.c +52 -104
- data/ext/isomorfeus_ferret_ext/frt_q_range.c +6 -12
- data/ext/isomorfeus_ferret_ext/frt_q_span.c +113 -226
- data/ext/isomorfeus_ferret_ext/frt_q_wildcard.c +1 -2
- data/ext/isomorfeus_ferret_ext/frt_ram_store.c +134 -85
- data/ext/isomorfeus_ferret_ext/frt_search.c +82 -164
- data/ext/isomorfeus_ferret_ext/frt_similarity.c +11 -22
- data/ext/isomorfeus_ferret_ext/frt_similarity.h +1 -2
- data/ext/isomorfeus_ferret_ext/frt_store.c +13 -25
- data/ext/isomorfeus_ferret_ext/frt_store.h +86 -52
- data/ext/isomorfeus_ferret_ext/frt_term_vectors.c +8 -16
- data/ext/isomorfeus_ferret_ext/frt_win32.h +5 -10
- data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.c +12 -11
- data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.h +11 -13
- data/ext/isomorfeus_ferret_ext/lz4.c +422 -195
- data/ext/isomorfeus_ferret_ext/lz4.h +114 -46
- data/ext/isomorfeus_ferret_ext/lz4frame.c +421 -242
- data/ext/isomorfeus_ferret_ext/lz4frame.h +122 -53
- data/ext/isomorfeus_ferret_ext/lz4hc.c +127 -111
- data/ext/isomorfeus_ferret_ext/lz4hc.h +14 -14
- data/ext/isomorfeus_ferret_ext/lz4xxhash.h +1 -1
- data/ext/isomorfeus_ferret_ext/mdbx.c +3762 -2526
- data/ext/isomorfeus_ferret_ext/mdbx.h +115 -70
- data/ext/isomorfeus_ferret_ext/test.c +40 -87
- data/ext/isomorfeus_ferret_ext/test.h +3 -6
- data/ext/isomorfeus_ferret_ext/test_1710.c +11 -13
- data/ext/isomorfeus_ferret_ext/test_analysis.c +32 -64
- data/ext/isomorfeus_ferret_ext/test_array.c +6 -12
- data/ext/isomorfeus_ferret_ext/test_bitvector.c +12 -24
- data/ext/isomorfeus_ferret_ext/test_document.c +23 -33
- data/ext/isomorfeus_ferret_ext/test_except.c +10 -21
- data/ext/isomorfeus_ferret_ext/test_fields.c +62 -68
- data/ext/isomorfeus_ferret_ext/test_file_deleter.c +15 -23
- data/ext/isomorfeus_ferret_ext/test_filter.c +17 -27
- data/ext/isomorfeus_ferret_ext/test_global.c +14 -29
- data/ext/isomorfeus_ferret_ext/test_hash.c +19 -38
- data/ext/isomorfeus_ferret_ext/test_hashset.c +8 -16
- data/ext/isomorfeus_ferret_ext/test_helper.c +4 -8
- data/ext/isomorfeus_ferret_ext/test_highlighter.c +16 -28
- data/ext/isomorfeus_ferret_ext/test_index.c +277 -487
- data/ext/isomorfeus_ferret_ext/test_lang.c +7 -14
- data/ext/isomorfeus_ferret_ext/test_mdbx_store.c +2 -5
- data/ext/isomorfeus_ferret_ext/test_mempool.c +5 -10
- data/ext/isomorfeus_ferret_ext/test_multimapper.c +3 -6
- data/ext/isomorfeus_ferret_ext/test_priorityqueue.c +9 -18
- data/ext/isomorfeus_ferret_ext/test_q_const_score.c +4 -6
- data/ext/isomorfeus_ferret_ext/test_q_filtered.c +3 -4
- data/ext/isomorfeus_ferret_ext/test_q_fuzzy.c +9 -15
- data/ext/isomorfeus_ferret_ext/test_q_parser.c +8 -16
- data/ext/isomorfeus_ferret_ext/test_q_span.c +19 -35
- data/ext/isomorfeus_ferret_ext/test_ram_store.c +14 -13
- data/ext/isomorfeus_ferret_ext/test_search.c +60 -109
- data/ext/isomorfeus_ferret_ext/test_segments.c +8 -13
- data/ext/isomorfeus_ferret_ext/test_similarity.c +2 -4
- data/ext/isomorfeus_ferret_ext/test_sort.c +14 -24
- data/ext/isomorfeus_ferret_ext/test_store.c +96 -115
- data/ext/isomorfeus_ferret_ext/test_term.c +9 -15
- data/ext/isomorfeus_ferret_ext/test_term_vectors.c +9 -14
- data/ext/isomorfeus_ferret_ext/test_test.c +4 -8
- data/ext/isomorfeus_ferret_ext/test_threading.c +14 -20
- data/ext/isomorfeus_ferret_ext/testhelper.c +11 -21
- data/ext/isomorfeus_ferret_ext/testhelper.h +1 -1
- data/ext/isomorfeus_ferret_ext/tests_all.h +1 -2
- data/lib/isomorfeus/ferret/index/index.rb +1 -1
- data/lib/isomorfeus/ferret/version.rb +1 -1
- metadata +24 -4
@@ -11,8 +11,7 @@
|
|
11
11
|
*
|
12
12
|
***************************************************************************/
|
13
13
|
|
14
|
-
FrtExplanation *frt_expl_new(float value, const char *description, ...)
|
15
|
-
{
|
14
|
+
FrtExplanation *frt_expl_new(float value, const char *description, ...) {
|
16
15
|
FrtExplanation *expl = FRT_ALLOC(FrtExplanation);
|
17
16
|
|
18
17
|
va_list args;
|
@@ -26,21 +25,18 @@ FrtExplanation *frt_expl_new(float value, const char *description, ...)
|
|
26
25
|
return expl;
|
27
26
|
}
|
28
27
|
|
29
|
-
void frt_expl_destroy(FrtExplanation *expl)
|
30
|
-
{
|
28
|
+
void frt_expl_destroy(FrtExplanation *expl) {
|
31
29
|
frt_ary_destroy((void **)expl->details, (frt_free_ft)frt_expl_destroy);
|
32
30
|
free(expl->description);
|
33
31
|
free(expl);
|
34
32
|
}
|
35
33
|
|
36
|
-
FrtExplanation *frt_expl_add_detail(FrtExplanation *expl, FrtExplanation *detail)
|
37
|
-
{
|
34
|
+
FrtExplanation *frt_expl_add_detail(FrtExplanation *expl, FrtExplanation *detail) {
|
38
35
|
frt_ary_push(expl->details, detail);
|
39
36
|
return expl;
|
40
37
|
}
|
41
38
|
|
42
|
-
char *frt_expl_to_s_depth(FrtExplanation *expl, int depth)
|
43
|
-
{
|
39
|
+
char *frt_expl_to_s_depth(FrtExplanation *expl, int depth) {
|
44
40
|
int i;
|
45
41
|
char *buffer = FRT_ALLOC_N(char, depth * 2 + 1);
|
46
42
|
const int num_details = frt_ary_size(expl->details);
|
@@ -57,8 +53,7 @@ char *frt_expl_to_s_depth(FrtExplanation *expl, int depth)
|
|
57
53
|
return buffer;
|
58
54
|
}
|
59
55
|
|
60
|
-
char *frt_expl_to_html(FrtExplanation *expl)
|
61
|
-
{
|
56
|
+
char *frt_expl_to_html(FrtExplanation *expl) {
|
62
57
|
int i;
|
63
58
|
char *buffer;
|
64
59
|
const int num_details = frt_ary_size(expl->details);
|
@@ -79,8 +74,7 @@ char *frt_expl_to_html(FrtExplanation *expl)
|
|
79
74
|
*
|
80
75
|
***************************************************************************/
|
81
76
|
|
82
|
-
static bool hit_lt(FrtHit *hit1, FrtHit *hit2)
|
83
|
-
{
|
77
|
+
static bool hit_lt(FrtHit *hit1, FrtHit *hit2) {
|
84
78
|
if (hit1->score == hit2->score) {
|
85
79
|
return hit1->doc > hit2->doc;
|
86
80
|
} else {
|
@@ -88,8 +82,7 @@ static bool hit_lt(FrtHit *hit1, FrtHit *hit2)
|
|
88
82
|
}
|
89
83
|
}
|
90
84
|
|
91
|
-
static void hit_pq_down(FrtPriorityQueue *pq)
|
92
|
-
{
|
85
|
+
static void hit_pq_down(FrtPriorityQueue *pq) {
|
93
86
|
register int i = 1;
|
94
87
|
register int j = 2; /* i << 1; */
|
95
88
|
register int k = 3; /* j + 1; */
|
@@ -112,8 +105,7 @@ static void hit_pq_down(FrtPriorityQueue *pq)
|
|
112
105
|
heap[i] = node;
|
113
106
|
}
|
114
107
|
|
115
|
-
static FrtHit *hit_pq_pop(FrtPriorityQueue *pq)
|
116
|
-
{
|
108
|
+
static FrtHit *hit_pq_pop(FrtPriorityQueue *pq) {
|
117
109
|
if (pq->size > 0) {
|
118
110
|
FrtHit **heap = (FrtHit **)pq->heap;
|
119
111
|
FrtHit *result = heap[1]; /* save first value */
|
@@ -122,14 +114,12 @@ static FrtHit *hit_pq_pop(FrtPriorityQueue *pq)
|
|
122
114
|
pq->size--;
|
123
115
|
hit_pq_down(pq); /* adjust heap */
|
124
116
|
return result;
|
125
|
-
}
|
126
|
-
else {
|
117
|
+
} else {
|
127
118
|
return NULL;
|
128
119
|
}
|
129
120
|
}
|
130
121
|
|
131
|
-
static void hit_pq_up(FrtPriorityQueue *pq)
|
132
|
-
{
|
122
|
+
static void hit_pq_up(FrtPriorityQueue *pq) {
|
133
123
|
FrtHit **heap = (FrtHit **)pq->heap;
|
134
124
|
FrtHit *node;
|
135
125
|
int i = pq->size;
|
@@ -144,8 +134,7 @@ static void hit_pq_up(FrtPriorityQueue *pq)
|
|
144
134
|
heap[i] = node;
|
145
135
|
}
|
146
136
|
|
147
|
-
static void hit_pq_insert(FrtPriorityQueue *pq, FrtHit *hit)
|
148
|
-
{
|
137
|
+
static void hit_pq_insert(FrtPriorityQueue *pq, FrtHit *hit) {
|
149
138
|
if (pq->size < pq->capa) {
|
150
139
|
FrtHit *new_hit = FRT_ALLOC(FrtHit);
|
151
140
|
memcpy(new_hit, hit, sizeof(FrtHit));
|
@@ -162,8 +151,7 @@ static void hit_pq_insert(FrtPriorityQueue *pq, FrtHit *hit)
|
|
162
151
|
}
|
163
152
|
}
|
164
153
|
|
165
|
-
static void hit_pq_multi_insert(FrtPriorityQueue *pq, FrtHit *hit)
|
166
|
-
{
|
154
|
+
static void hit_pq_multi_insert(FrtPriorityQueue *pq, FrtHit *hit) {
|
167
155
|
hit_pq_insert(pq, hit);
|
168
156
|
free(hit);
|
169
157
|
}
|
@@ -174,8 +162,7 @@ static void hit_pq_multi_insert(FrtPriorityQueue *pq, FrtHit *hit)
|
|
174
162
|
*
|
175
163
|
***************************************************************************/
|
176
164
|
|
177
|
-
FrtTopDocs *frt_td_new(int total_hits, int size, FrtHit **hits, float max_score)
|
178
|
-
{
|
165
|
+
FrtTopDocs *frt_td_new(int total_hits, int size, FrtHit **hits, float max_score) {
|
179
166
|
FrtTopDocs *td = FRT_ALLOC(FrtTopDocs);
|
180
167
|
td->total_hits = total_hits;
|
181
168
|
td->size = size;
|
@@ -184,8 +171,7 @@ FrtTopDocs *frt_td_new(int total_hits, int size, FrtHit **hits, float max_score)
|
|
184
171
|
return td;
|
185
172
|
}
|
186
173
|
|
187
|
-
void frt_td_destroy(FrtTopDocs *td)
|
188
|
-
{
|
174
|
+
void frt_td_destroy(FrtTopDocs *td) {
|
189
175
|
int i;
|
190
176
|
|
191
177
|
for (i = 0; i < td->size; i++) {
|
@@ -195,8 +181,7 @@ void frt_td_destroy(FrtTopDocs *td)
|
|
195
181
|
free(td);
|
196
182
|
}
|
197
183
|
|
198
|
-
char *frt_td_to_s(FrtTopDocs *td)
|
199
|
-
{
|
184
|
+
char *frt_td_to_s(FrtTopDocs *td) {
|
200
185
|
int i;
|
201
186
|
FrtHit *hit;
|
202
187
|
char *buffer = frt_strfmt("%d hits sorted by <score, doc_num>\n",
|
@@ -214,37 +199,31 @@ char *frt_td_to_s(FrtTopDocs *td)
|
|
214
199
|
*
|
215
200
|
***************************************************************************/
|
216
201
|
|
217
|
-
FrtQuery *frt_w_get_query(FrtWeight *self)
|
218
|
-
{
|
202
|
+
FrtQuery *frt_w_get_query(FrtWeight *self) {
|
219
203
|
return self->query;
|
220
204
|
}
|
221
205
|
|
222
|
-
float frt_w_get_value(FrtWeight *self)
|
223
|
-
{
|
206
|
+
float frt_w_get_value(FrtWeight *self) {
|
224
207
|
return self->value;
|
225
208
|
}
|
226
209
|
|
227
|
-
float frt_w_sum_of_squared_weights(FrtWeight *self)
|
228
|
-
{
|
210
|
+
float frt_w_sum_of_squared_weights(FrtWeight *self) {
|
229
211
|
self->qweight = self->idf * self->query->boost;
|
230
212
|
return self->qweight * self->qweight; /* square it */
|
231
213
|
}
|
232
214
|
|
233
|
-
void frt_w_normalize(FrtWeight *self, float normalization_factor)
|
234
|
-
{
|
215
|
+
void frt_w_normalize(FrtWeight *self, float normalization_factor) {
|
235
216
|
self->qnorm = normalization_factor;
|
236
217
|
self->qweight *= normalization_factor; /* normalize query weight */
|
237
218
|
self->value = self->qweight * self->idf;/* idf for document */
|
238
219
|
}
|
239
220
|
|
240
|
-
void frt_w_destroy(FrtWeight *self)
|
241
|
-
{
|
221
|
+
void frt_w_destroy(FrtWeight *self) {
|
242
222
|
frt_q_deref(self->query);
|
243
223
|
free(self);
|
244
224
|
}
|
245
225
|
|
246
|
-
FrtWeight *frt_w_create(size_t size, FrtQuery *query)
|
247
|
-
{
|
226
|
+
FrtWeight *frt_w_create(size_t size, FrtQuery *query) {
|
248
227
|
FrtWeight *self = (FrtWeight *)frt_ecalloc(size);
|
249
228
|
#ifdef DEBUG
|
250
229
|
if (size < sizeof(FrtWeight)) {
|
@@ -294,14 +273,12 @@ static const char *UNKNOWN_QUERY_NAME = "UnkownQuery";
|
|
294
273
|
const char *frt_q_get_query_name(FrtQueryType type) {
|
295
274
|
if (type >= FRT_NELEMS(QUERY_NAMES)) {
|
296
275
|
return UNKNOWN_QUERY_NAME;
|
297
|
-
}
|
298
|
-
else {
|
276
|
+
} else {
|
299
277
|
return QUERY_NAMES[type];
|
300
278
|
}
|
301
279
|
}
|
302
280
|
|
303
|
-
static FrtQuery *q_rewrite(FrtQuery *self, FrtIndexReader *ir)
|
304
|
-
{
|
281
|
+
static FrtQuery *q_rewrite(FrtQuery *self, FrtIndexReader *ir) {
|
305
282
|
(void)ir;
|
306
283
|
FRT_REF(self);
|
307
284
|
return self;
|
@@ -469,13 +446,11 @@ int frt_scorer_doc_cmp(const void *p1, const void *p2) {
|
|
469
446
|
***************************************************************************/
|
470
447
|
|
471
448
|
/* ** MatchRange ** */
|
472
|
-
static int match_range_cmp(const void *p1, const void *p2)
|
473
|
-
{
|
449
|
+
static int match_range_cmp(const void *p1, const void *p2) {
|
474
450
|
int diff = ((FrtMatchRange *)p1)->start - ((FrtMatchRange *)p2)->start;
|
475
451
|
if (diff != 0) {
|
476
452
|
return diff;
|
477
|
-
}
|
478
|
-
else {
|
453
|
+
} else {
|
479
454
|
return ((FrtMatchRange *)p2)->end - ((FrtMatchRange *)p1)->end;
|
480
455
|
}
|
481
456
|
}
|
@@ -491,8 +466,7 @@ FrtMatchVector *frt_matchv_new(void) {
|
|
491
466
|
return matchv;
|
492
467
|
}
|
493
468
|
|
494
|
-
FrtMatchVector *frt_matchv_add(FrtMatchVector *self, int start, int end)
|
495
|
-
{
|
469
|
+
FrtMatchVector *frt_matchv_add(FrtMatchVector *self, int start, int end) {
|
496
470
|
if (self->size >= self->capa) {
|
497
471
|
self->capa <<= 1;
|
498
472
|
FRT_REALLOC_N(self->matches, FrtMatchRange, self->capa);
|
@@ -504,14 +478,12 @@ FrtMatchVector *frt_matchv_add(FrtMatchVector *self, int start, int end)
|
|
504
478
|
return self;
|
505
479
|
}
|
506
480
|
|
507
|
-
FrtMatchVector *frt_matchv_sort(FrtMatchVector *self)
|
508
|
-
{
|
481
|
+
FrtMatchVector *frt_matchv_sort(FrtMatchVector *self) {
|
509
482
|
qsort(self->matches, self->size, sizeof(FrtMatchRange), &match_range_cmp);
|
510
483
|
return self;
|
511
484
|
}
|
512
485
|
|
513
|
-
FrtMatchVector *frt_matchv_compact(FrtMatchVector *self)
|
514
|
-
{
|
486
|
+
FrtMatchVector *frt_matchv_compact(FrtMatchVector *self) {
|
515
487
|
int left, right;
|
516
488
|
frt_matchv_sort(self);
|
517
489
|
for (right = left = 0; right < self->size; right++) {
|
@@ -521,11 +493,9 @@ FrtMatchVector *frt_matchv_compact(FrtMatchVector *self)
|
|
521
493
|
self->matches[left].start = self->matches[right].start;
|
522
494
|
self->matches[left].end = self->matches[right].end;
|
523
495
|
self->matches[left].score = self->matches[right].score;
|
524
|
-
}
|
525
|
-
else if (self->matches[right].end > self->matches[left].end) {
|
496
|
+
} else if (self->matches[right].end > self->matches[left].end) {
|
526
497
|
self->matches[left].end = self->matches[right].end;
|
527
|
-
}
|
528
|
-
else {
|
498
|
+
} else {
|
529
499
|
self->matches[left].score += self->matches[right].score;
|
530
500
|
}
|
531
501
|
}
|
@@ -533,8 +503,7 @@ FrtMatchVector *frt_matchv_compact(FrtMatchVector *self)
|
|
533
503
|
return self;
|
534
504
|
}
|
535
505
|
|
536
|
-
FrtMatchVector *frt_matchv_compact_with_breaks(FrtMatchVector *self)
|
537
|
-
{
|
506
|
+
FrtMatchVector *frt_matchv_compact_with_breaks(FrtMatchVector *self) {
|
538
507
|
int left, right;
|
539
508
|
frt_matchv_sort(self);
|
540
509
|
for (right = left = 0; right < self->size; right++) {
|
@@ -544,12 +513,10 @@ FrtMatchVector *frt_matchv_compact_with_breaks(FrtMatchVector *self)
|
|
544
513
|
self->matches[left].start = self->matches[right].start;
|
545
514
|
self->matches[left].end = self->matches[right].end;
|
546
515
|
self->matches[left].score = self->matches[right].score;
|
547
|
-
}
|
548
|
-
else if (self->matches[right].end > self->matches[left].end) {
|
516
|
+
} else if (self->matches[right].end > self->matches[left].end) {
|
549
517
|
self->matches[left].end = self->matches[right].end;
|
550
518
|
self->matches[left].score += self->matches[right].score;
|
551
|
-
}
|
552
|
-
else if (right > left) {
|
519
|
+
} else if (right > left) {
|
553
520
|
self->matches[left].score += self->matches[right].score;
|
554
521
|
}
|
555
522
|
}
|
@@ -557,8 +524,7 @@ FrtMatchVector *frt_matchv_compact_with_breaks(FrtMatchVector *self)
|
|
557
524
|
return self;
|
558
525
|
}
|
559
526
|
|
560
|
-
static FrtMatchVector *matchv_set_offsets(FrtMatchVector *mv, FrtOffset *offsets)
|
561
|
-
{
|
527
|
+
static FrtMatchVector *matchv_set_offsets(FrtMatchVector *mv, FrtOffset *offsets) {
|
562
528
|
int i;
|
563
529
|
for (i = 0; i < mv->size; i++) {
|
564
530
|
mv->matches[i].start_offset = offsets[mv->matches[i].start].start;
|
@@ -567,8 +533,7 @@ static FrtMatchVector *matchv_set_offsets(FrtMatchVector *mv, FrtOffset *offsets
|
|
567
533
|
return mv;
|
568
534
|
}
|
569
535
|
|
570
|
-
void frt_matchv_destroy(FrtMatchVector *self)
|
571
|
-
{
|
536
|
+
void frt_matchv_destroy(FrtMatchVector *self) {
|
572
537
|
free(self->matches);
|
573
538
|
free(self);
|
574
539
|
}
|
@@ -607,8 +572,7 @@ typedef struct Excerpt {
|
|
607
572
|
} Excerpt;
|
608
573
|
|
609
574
|
/*
|
610
|
-
static int excerpt_cmp(const void *p1, const void *p2)
|
611
|
-
{
|
575
|
+
static int excerpt_cmp(const void *p1, const void *p2) {
|
612
576
|
double score1 = (*((Excerpt **)p1))->score;
|
613
577
|
double score2 = (*((Excerpt **)p2))->score;
|
614
578
|
if (score1 > score2) return 1;
|
@@ -617,18 +581,15 @@ static int excerpt_cmp(const void *p1, const void *p2)
|
|
617
581
|
}
|
618
582
|
*/
|
619
583
|
|
620
|
-
static int excerpt_start_cmp(const void *p1, const void *p2)
|
621
|
-
{
|
584
|
+
static int excerpt_start_cmp(const void *p1, const void *p2) {
|
622
585
|
return (*((Excerpt **)p1))->start - (*((Excerpt **)p2))->start;
|
623
586
|
}
|
624
587
|
|
625
|
-
static int excerpt_lt(Excerpt *e1, Excerpt *e2)
|
626
|
-
{
|
588
|
+
static int excerpt_lt(Excerpt *e1, Excerpt *e2) {
|
627
589
|
return e1->score > e2->score; /* want the highest score at top */
|
628
590
|
}
|
629
591
|
|
630
|
-
static Excerpt *excerpt_new(int start, int end, double score)
|
631
|
-
{
|
592
|
+
static Excerpt *excerpt_new(int start, int end, double score) {
|
632
593
|
Excerpt *excerpt = FRT_ALLOC_AND_ZERO(Excerpt);
|
633
594
|
excerpt->start = start;
|
634
595
|
excerpt->end = end;
|
@@ -636,8 +597,7 @@ static Excerpt *excerpt_new(int start, int end, double score)
|
|
636
597
|
return excerpt;
|
637
598
|
}
|
638
599
|
|
639
|
-
static Excerpt *excerpt_recalc_score(Excerpt *e, FrtMatchVector *mv)
|
640
|
-
{
|
600
|
+
static Excerpt *excerpt_recalc_score(Excerpt *e, FrtMatchVector *mv) {
|
641
601
|
int i;
|
642
602
|
double score = 0.0;
|
643
603
|
for (i = e->start; i <= e->end; i++) {
|
@@ -648,8 +608,7 @@ static Excerpt *excerpt_recalc_score(Excerpt *e, FrtMatchVector *mv)
|
|
648
608
|
}
|
649
609
|
|
650
610
|
/* expand an excerpt to it's largest possible size */
|
651
|
-
static Excerpt *excerpt_expand(Excerpt *e, const int len, FrtTermVector *tv)
|
652
|
-
{
|
611
|
+
static Excerpt *excerpt_expand(Excerpt *e, const int len, FrtTermVector *tv) {
|
653
612
|
FrtOffset *offsets = tv->offsets;
|
654
613
|
int offset_cnt = tv->offset_cnt;
|
655
614
|
bool did_expansion = true;
|
@@ -686,8 +645,7 @@ static char *excerpt_get_str(Excerpt *e, FrtMatchVector *mv,
|
|
686
645
|
FrtLazyDocField *lazy_df,
|
687
646
|
const char *pre_tag,
|
688
647
|
const char *post_tag,
|
689
|
-
const char *ellipsis)
|
690
|
-
{
|
648
|
+
const char *ellipsis) {
|
691
649
|
int i, len;
|
692
650
|
int last_offset = e->start_offset;
|
693
651
|
const int num_matches = e->end - e->start + 1;
|
@@ -742,8 +700,7 @@ static char *highlight_field(FrtMatchVector *mv,
|
|
742
700
|
FrtLazyDocField *lazy_df,
|
743
701
|
FrtTermVector *tv,
|
744
702
|
const char *pre_tag,
|
745
|
-
const char *post_tag)
|
746
|
-
{
|
703
|
+
const char *post_tag) {
|
747
704
|
const int pre_len = (int)strlen(pre_tag);
|
748
705
|
const int post_len = (int)strlen(post_tag);
|
749
706
|
char *excerpt_str =
|
@@ -778,8 +735,7 @@ static char *highlight_field(FrtMatchVector *mv,
|
|
778
735
|
e_ptr += len;
|
779
736
|
}
|
780
737
|
*e_ptr = '\0';
|
781
|
-
}
|
782
|
-
else {
|
738
|
+
} else {
|
783
739
|
frt_lazy_df_get_bytes(lazy_df, excerpt_str, 0, lazy_df->len);
|
784
740
|
excerpt_str[lazy_df->len] = '\0';
|
785
741
|
}
|
@@ -812,8 +768,7 @@ char **frt_searcher_highlight(FrtSearcher *self,
|
|
812
768
|
excerpt_strs = frt_ary_new_type_capa(char *, 1);
|
813
769
|
frt_ary_push(excerpt_strs,
|
814
770
|
highlight_field(mv, lazy_df, tv, pre_tag, post_tag));
|
815
|
-
}
|
816
|
-
else if (mv->size > 0) {
|
771
|
+
} else if (mv->size > 0) {
|
817
772
|
Excerpt **excerpts = FRT_ALLOC_AND_ZERO_N(Excerpt *, num_excerpts);
|
818
773
|
int e_start, e_end, i, j;
|
819
774
|
FrtMatchRange *matches = mv->matches;
|
@@ -915,13 +870,11 @@ char **frt_searcher_highlight(FrtSearcher *self,
|
|
915
870
|
return excerpt_strs;
|
916
871
|
}
|
917
872
|
|
918
|
-
static FrtWeight *sea_create_weight(FrtSearcher *self, FrtQuery *query)
|
919
|
-
{
|
873
|
+
static FrtWeight *sea_create_weight(FrtSearcher *self, FrtQuery *query) {
|
920
874
|
return frt_q_weight(query, self);
|
921
875
|
}
|
922
876
|
|
923
|
-
static void sea_check_args(int num_docs, int first_doc)
|
924
|
-
{
|
877
|
+
static void sea_check_args(int num_docs, int first_doc) {
|
925
878
|
if (num_docs <= 0) {
|
926
879
|
FRT_RAISE(FRT_ARG_ERROR, ":num_docs was set to %d but should be greater "
|
927
880
|
"than 0 : %d <= 0", num_docs, num_docs);
|
@@ -933,8 +886,7 @@ static void sea_check_args(int num_docs, int first_doc)
|
|
933
886
|
}
|
934
887
|
}
|
935
888
|
|
936
|
-
static FrtSimilarity *sea_get_similarity(FrtSearcher *self)
|
937
|
-
{
|
889
|
+
static FrtSimilarity *sea_get_similarity(FrtSearcher *self) {
|
938
890
|
return self->similarity;
|
939
891
|
}
|
940
892
|
|
@@ -950,20 +902,17 @@ int frt_isea_doc_freq(FrtSearcher *self, ID field, const char *term) {
|
|
950
902
|
return frt_ir_doc_freq(ISEA(self)->ir, field, term);
|
951
903
|
}
|
952
904
|
|
953
|
-
static FrtDocument *isea_get_doc(FrtSearcher *self, int doc_num)
|
954
|
-
{
|
905
|
+
static FrtDocument *isea_get_doc(FrtSearcher *self, int doc_num) {
|
955
906
|
FrtIndexReader *ir = ISEA(self)->ir;
|
956
907
|
return ir->get_doc(ir, doc_num);
|
957
908
|
}
|
958
909
|
|
959
|
-
static FrtLazyDoc *isea_get_lazy_doc(FrtSearcher *self, int doc_num)
|
960
|
-
{
|
910
|
+
static FrtLazyDoc *isea_get_lazy_doc(FrtSearcher *self, int doc_num) {
|
961
911
|
FrtIndexReader *ir = ISEA(self)->ir;
|
962
912
|
return ir->get_lazy_doc(ir, doc_num);
|
963
913
|
}
|
964
914
|
|
965
|
-
static int isea_max_doc(FrtSearcher *self)
|
966
|
-
{
|
915
|
+
static int isea_max_doc(FrtSearcher *self) {
|
967
916
|
FrtIndexReader *ir = ISEA(self)->ir;
|
968
917
|
return ir->max_doc(ir);
|
969
918
|
}
|
@@ -982,8 +931,7 @@ static FrtTopDocs *isea_search_w(FrtSearcher *self,
|
|
982
931
|
FrtFilter *filter,
|
983
932
|
FrtSort *sort,
|
984
933
|
FrtPostFilter *post_filter,
|
985
|
-
bool load_fields)
|
986
|
-
{
|
934
|
+
bool load_fields) {
|
987
935
|
int max_size = num_docs + (num_docs == INT_MAX ? 0 : first_doc);
|
988
936
|
int i;
|
989
937
|
int total_hits = 0;
|
@@ -1066,8 +1014,7 @@ static FrtTopDocs *isea_search(FrtSearcher *self,
|
|
1066
1014
|
FrtFilter *filter,
|
1067
1015
|
FrtSort *sort,
|
1068
1016
|
FrtPostFilter *post_filter,
|
1069
|
-
bool load_fields)
|
1070
|
-
{
|
1017
|
+
bool load_fields) {
|
1071
1018
|
FrtTopDocs *td;
|
1072
1019
|
FrtWeight *weight = frt_q_weight(query, self);
|
1073
1020
|
td = isea_search_w(self, weight, first_doc, num_docs, filter, sort, post_filter, load_fields);
|
@@ -1078,8 +1025,7 @@ static FrtTopDocs *isea_search(FrtSearcher *self,
|
|
1078
1025
|
static void isea_search_each_w(FrtSearcher *self, FrtWeight *weight, FrtFilter *filter,
|
1079
1026
|
FrtPostFilter *post_filter,
|
1080
1027
|
void (*fn)(FrtSearcher *, int, float, void *),
|
1081
|
-
void *arg)
|
1082
|
-
{
|
1028
|
+
void *arg) {
|
1083
1029
|
FrtScorer *scorer;
|
1084
1030
|
float filter_factor = 1.0f;
|
1085
1031
|
FrtBitVector *bits = (filter
|
@@ -1110,8 +1056,7 @@ static void isea_search_each_w(FrtSearcher *self, FrtWeight *weight, FrtFilter *
|
|
1110
1056
|
static void isea_search_each(FrtSearcher *self, FrtQuery *query, FrtFilter *filter,
|
1111
1057
|
FrtPostFilter *post_filter,
|
1112
1058
|
void (*fn)(FrtSearcher *, int, float, void *),
|
1113
|
-
void *arg)
|
1114
|
-
{
|
1059
|
+
void *arg) {
|
1115
1060
|
FrtWeight *weight = frt_q_weight(query, self);
|
1116
1061
|
isea_search_each_w(self, weight, filter, post_filter, fn, arg);
|
1117
1062
|
weight->destroy(weight);
|
@@ -1227,8 +1172,7 @@ FrtSearcher *frt_isea_new(FrtIndexReader *ir) {
|
|
1227
1172
|
***************************************************************************/
|
1228
1173
|
|
1229
1174
|
#define CDFSEA(searcher) ((CachedDFSearcher *)(searcher))
|
1230
|
-
typedef struct CachedDFSearcher
|
1231
|
-
{
|
1175
|
+
typedef struct CachedDFSearcher {
|
1232
1176
|
FrtSearcher super;
|
1233
1177
|
FrtHash *df_map;
|
1234
1178
|
int max_doc;
|
@@ -1243,29 +1187,25 @@ static int cdfsea_doc_freq(FrtSearcher *self, ID field, const char *text) {
|
|
1243
1187
|
return df ? *df : 0;
|
1244
1188
|
}
|
1245
1189
|
|
1246
|
-
static FrtDocument *cdfsea_get_doc(FrtSearcher *self, int doc_num)
|
1247
|
-
{
|
1190
|
+
static FrtDocument *cdfsea_get_doc(FrtSearcher *self, int doc_num) {
|
1248
1191
|
(void)self; (void)doc_num;
|
1249
1192
|
FRT_RAISE(FRT_UNSUPPORTED_ERROR, "%s", FRT_UNSUPPORTED_ERROR_MSG);
|
1250
1193
|
return NULL;
|
1251
1194
|
}
|
1252
1195
|
|
1253
|
-
static int cdfsea_max_doc(FrtSearcher *self)
|
1254
|
-
{
|
1196
|
+
static int cdfsea_max_doc(FrtSearcher *self) {
|
1255
1197
|
(void)self;
|
1256
1198
|
return CDFSEA(self)->max_doc;
|
1257
1199
|
}
|
1258
1200
|
|
1259
|
-
static FrtWeight *cdfsea_create_weight(FrtSearcher *self, FrtQuery *query)
|
1260
|
-
{
|
1201
|
+
static FrtWeight *cdfsea_create_weight(FrtSearcher *self, FrtQuery *query) {
|
1261
1202
|
(void)self; (void)query;
|
1262
1203
|
FRT_RAISE(FRT_UNSUPPORTED_ERROR, "%s", FRT_UNSUPPORTED_ERROR_MSG);
|
1263
1204
|
return NULL;
|
1264
1205
|
}
|
1265
1206
|
|
1266
1207
|
static FrtTopDocs *cdfsea_search_w(FrtSearcher *self, FrtWeight *w, int fd, int nd,
|
1267
|
-
FrtFilter *f, FrtSort *s, FrtPostFilter *pf, bool load)
|
1268
|
-
{
|
1208
|
+
FrtFilter *f, FrtSort *s, FrtPostFilter *pf, bool load) {
|
1269
1209
|
(void)self; (void)w; (void)fd; (void)nd;
|
1270
1210
|
(void)f; (void)s; (void)pf; (void)load;
|
1271
1211
|
FRT_RAISE(FRT_UNSUPPORTED_ERROR, "%s", FRT_UNSUPPORTED_ERROR_MSG);
|
@@ -1273,8 +1213,7 @@ static FrtTopDocs *cdfsea_search_w(FrtSearcher *self, FrtWeight *w, int fd, int
|
|
1273
1213
|
}
|
1274
1214
|
|
1275
1215
|
static FrtTopDocs *cdfsea_search(FrtSearcher *self, FrtQuery *q, int fd, int nd,
|
1276
|
-
FrtFilter *f, FrtSort *s, FrtPostFilter *pf, bool load)
|
1277
|
-
{
|
1216
|
+
FrtFilter *f, FrtSort *s, FrtPostFilter *pf, bool load) {
|
1278
1217
|
(void)self; (void)q; (void)fd; (void)nd;
|
1279
1218
|
(void)f; (void)s; (void)pf; (void)load;
|
1280
1219
|
FRT_RAISE(FRT_UNSUPPORTED_ERROR, "%s", FRT_UNSUPPORTED_ERROR_MSG);
|
@@ -1284,8 +1223,7 @@ static FrtTopDocs *cdfsea_search(FrtSearcher *self, FrtQuery *q, int fd, int nd,
|
|
1284
1223
|
static void cdfsea_search_each(FrtSearcher *self, FrtQuery *query, FrtFilter *filter,
|
1285
1224
|
FrtPostFilter *pf,
|
1286
1225
|
void (*fn)(FrtSearcher *, int, float, void *),
|
1287
|
-
void *arg)
|
1288
|
-
{
|
1226
|
+
void *arg) {
|
1289
1227
|
(void)self; (void)query; (void)filter; (void)pf; (void)fn; (void)arg;
|
1290
1228
|
FRT_RAISE(FRT_UNSUPPORTED_ERROR, "%s", FRT_UNSUPPORTED_ERROR_MSG);
|
1291
1229
|
}
|
@@ -1293,28 +1231,24 @@ static void cdfsea_search_each(FrtSearcher *self, FrtQuery *query, FrtFilter *fi
|
|
1293
1231
|
static void cdfsea_search_each_w(FrtSearcher *self, FrtWeight *w, FrtFilter *filter,
|
1294
1232
|
FrtPostFilter *pf,
|
1295
1233
|
void (*fn)(FrtSearcher *, int, float, void *),
|
1296
|
-
void *arg)
|
1297
|
-
{
|
1234
|
+
void *arg) {
|
1298
1235
|
(void)self; (void)w; (void)filter; (void)pf; (void)fn; (void)arg;
|
1299
1236
|
FRT_RAISE(FRT_UNSUPPORTED_ERROR, "%s", FRT_UNSUPPORTED_ERROR_MSG);
|
1300
1237
|
}
|
1301
1238
|
|
1302
|
-
static FrtQuery *cdfsea_rewrite(FrtSearcher *self, FrtQuery *original)
|
1303
|
-
{
|
1239
|
+
static FrtQuery *cdfsea_rewrite(FrtSearcher *self, FrtQuery *original) {
|
1304
1240
|
(void)self;
|
1305
1241
|
FRT_REF(original);
|
1306
1242
|
return original;
|
1307
1243
|
}
|
1308
1244
|
|
1309
|
-
static FrtExplanation *cdfsea_explain(FrtSearcher *self, FrtQuery *query, int doc_num)
|
1310
|
-
{
|
1245
|
+
static FrtExplanation *cdfsea_explain(FrtSearcher *self, FrtQuery *query, int doc_num) {
|
1311
1246
|
(void)self; (void)query; (void)doc_num;
|
1312
1247
|
FRT_RAISE(FRT_UNSUPPORTED_ERROR, "%s", FRT_UNSUPPORTED_ERROR_MSG);
|
1313
1248
|
return NULL;
|
1314
1249
|
}
|
1315
1250
|
|
1316
|
-
static FrtExplanation *cdfsea_explain_w(FrtSearcher *self, FrtWeight *w, int doc_num)
|
1317
|
-
{
|
1251
|
+
static FrtExplanation *cdfsea_explain_w(FrtSearcher *self, FrtWeight *w, int doc_num) {
|
1318
1252
|
(void)self; (void)w; (void)doc_num;
|
1319
1253
|
FRT_RAISE(FRT_UNSUPPORTED_ERROR, "%s", FRT_UNSUPPORTED_ERROR_MSG);
|
1320
1254
|
return NULL;
|
@@ -1326,19 +1260,16 @@ static FrtTermVector *cdfsea_get_term_vector(FrtSearcher *self, const int doc_nu
|
|
1326
1260
|
return NULL;
|
1327
1261
|
}
|
1328
1262
|
|
1329
|
-
static FrtSimilarity *cdfsea_get_similarity(FrtSearcher *self)
|
1330
|
-
{
|
1263
|
+
static FrtSimilarity *cdfsea_get_similarity(FrtSearcher *self) {
|
1331
1264
|
return self->similarity;
|
1332
1265
|
}
|
1333
1266
|
|
1334
|
-
static void cdfsea_close(FrtSearcher *self)
|
1335
|
-
{
|
1267
|
+
static void cdfsea_close(FrtSearcher *self) {
|
1336
1268
|
frt_h_destroy(CDFSEA(self)->df_map);
|
1337
1269
|
free(self);
|
1338
1270
|
}
|
1339
1271
|
|
1340
|
-
static FrtSearcher *cdfsea_new(FrtHash *df_map, int max_doc)
|
1341
|
-
{
|
1272
|
+
static FrtSearcher *cdfsea_new(FrtHash *df_map, int max_doc) {
|
1342
1273
|
FrtSearcher *self = (FrtSearcher *)FRT_ALLOC(CachedDFSearcher);
|
1343
1274
|
|
1344
1275
|
CDFSEA(self)->df_map = df_map;
|
@@ -1369,8 +1300,7 @@ static FrtSearcher *cdfsea_new(FrtHash *df_map, int max_doc)
|
|
1369
1300
|
***************************************************************************/
|
1370
1301
|
|
1371
1302
|
#define MSEA(searcher) ((FrtMultiSearcher *)(searcher))
|
1372
|
-
static int msea_get_searcher_index(FrtSearcher *self, int n)
|
1373
|
-
{
|
1303
|
+
static int msea_get_searcher_index(FrtSearcher *self, int n) {
|
1374
1304
|
FrtMultiSearcher *msea = MSEA(self);
|
1375
1305
|
int lo = 0; /* search starts array */
|
1376
1306
|
int hi = msea->s_cnt - 1; /* for 1st element < n, return its index */
|
@@ -1381,11 +1311,9 @@ static int msea_get_searcher_index(FrtSearcher *self, int n)
|
|
1381
1311
|
mid_val = msea->starts[mid];
|
1382
1312
|
if (n < mid_val) {
|
1383
1313
|
hi = mid - 1;
|
1384
|
-
}
|
1385
|
-
else if (n > mid_val) {
|
1314
|
+
} else if (n > mid_val) {
|
1386
1315
|
lo = mid + 1;
|
1387
|
-
}
|
1388
|
-
else { /* found a match */
|
1316
|
+
} else { /* found a match */
|
1389
1317
|
while (((mid+1) < msea->s_cnt)
|
1390
1318
|
&& (msea->starts[mid+1] == mid_val)) {
|
1391
1319
|
mid++; /* scan to last match */
|
@@ -1408,29 +1336,25 @@ static int msea_doc_freq(FrtSearcher *self, ID field, const char *term) {
|
|
1408
1336
|
return doc_freq;
|
1409
1337
|
}
|
1410
1338
|
|
1411
|
-
static FrtDocument *msea_get_doc(FrtSearcher *self, int doc_num)
|
1412
|
-
{
|
1339
|
+
static FrtDocument *msea_get_doc(FrtSearcher *self, int doc_num) {
|
1413
1340
|
FrtMultiSearcher *msea = MSEA(self);
|
1414
1341
|
int i = msea_get_searcher_index(self, doc_num);
|
1415
1342
|
FrtSearcher *s = msea->searchers[i];
|
1416
1343
|
return s->get_doc(s, doc_num - msea->starts[i]);
|
1417
1344
|
}
|
1418
1345
|
|
1419
|
-
static FrtLazyDoc *msea_get_lazy_doc(FrtSearcher *self, int doc_num)
|
1420
|
-
{
|
1346
|
+
static FrtLazyDoc *msea_get_lazy_doc(FrtSearcher *self, int doc_num) {
|
1421
1347
|
FrtMultiSearcher *msea = MSEA(self);
|
1422
1348
|
int i = msea_get_searcher_index(self, doc_num);
|
1423
1349
|
FrtSearcher *s = msea->searchers[i];
|
1424
1350
|
return s->get_lazy_doc(s, doc_num - msea->starts[i]);
|
1425
1351
|
}
|
1426
1352
|
|
1427
|
-
static int msea_max_doc(FrtSearcher *self)
|
1428
|
-
{
|
1353
|
+
static int msea_max_doc(FrtSearcher *self) {
|
1429
1354
|
return MSEA(self)->max_doc;
|
1430
1355
|
}
|
1431
1356
|
|
1432
|
-
static int *msea_get_doc_freqs(FrtSearcher *self, FrtHashSet *terms)
|
1433
|
-
{
|
1357
|
+
static int *msea_get_doc_freqs(FrtSearcher *self, FrtHashSet *terms) {
|
1434
1358
|
int i;
|
1435
1359
|
FrtHashSetEntry *hse;
|
1436
1360
|
int *doc_freqs = FRT_ALLOC_N(int, terms->size);
|
@@ -1441,8 +1365,7 @@ static int *msea_get_doc_freqs(FrtSearcher *self, FrtHashSet *terms)
|
|
1441
1365
|
return doc_freqs;
|
1442
1366
|
}
|
1443
1367
|
|
1444
|
-
static FrtWeight *msea_create_weight(FrtSearcher *self, FrtQuery *query)
|
1445
|
-
{
|
1368
|
+
static FrtWeight *msea_create_weight(FrtSearcher *self, FrtQuery *query) {
|
1446
1369
|
int i, *doc_freqs;
|
1447
1370
|
FrtSearcher *cdfsea;
|
1448
1371
|
FrtWeight *w;
|
@@ -1481,8 +1404,7 @@ struct MultiSearchEachArg {
|
|
1481
1404
|
void (*fn)(FrtSearcher *, int, float, void *);
|
1482
1405
|
};
|
1483
1406
|
|
1484
|
-
static void msea_search_each_i(FrtSearcher *self, int doc_num, float score, void *arg)
|
1485
|
-
{
|
1407
|
+
static void msea_search_each_i(FrtSearcher *self, int doc_num, float score, void *arg) {
|
1486
1408
|
struct MultiSearchEachArg *mse_arg = (struct MultiSearchEachArg *)arg;
|
1487
1409
|
|
1488
1410
|
mse_arg->fn(self, doc_num + mse_arg->start, score, mse_arg->arg);
|
@@ -1491,8 +1413,7 @@ static void msea_search_each_i(FrtSearcher *self, int doc_num, float score, void
|
|
1491
1413
|
static void msea_search_each_w(FrtSearcher *self, FrtWeight *w, FrtFilter *filter,
|
1492
1414
|
FrtPostFilter *post_filter,
|
1493
1415
|
void (*fn)(FrtSearcher *, int, float, void *),
|
1494
|
-
void *arg)
|
1495
|
-
{
|
1416
|
+
void *arg) {
|
1496
1417
|
int i;
|
1497
1418
|
struct MultiSearchEachArg mse_arg;
|
1498
1419
|
FrtMultiSearcher *msea = MSEA(self);
|
@@ -1511,8 +1432,7 @@ static void msea_search_each_w(FrtSearcher *self, FrtWeight *w, FrtFilter *filte
|
|
1511
1432
|
static void msea_search_each(FrtSearcher *self, FrtQuery *query, FrtFilter *filter,
|
1512
1433
|
FrtPostFilter *post_filter,
|
1513
1434
|
void (*fn)(FrtSearcher *, int, float, void *),
|
1514
|
-
void *arg)
|
1515
|
-
{
|
1435
|
+
void *arg) {
|
1516
1436
|
FrtWeight *weight = frt_q_weight(query, self);
|
1517
1437
|
msea_search_each_w(self, weight, filter, post_filter, fn, arg);
|
1518
1438
|
weight->destroy(weight);
|
@@ -1522,8 +1442,7 @@ static int msea_search_unscored_w(FrtSearcher *self,
|
|
1522
1442
|
FrtWeight *w,
|
1523
1443
|
int *buf,
|
1524
1444
|
int limit,
|
1525
|
-
int offset_docnum)
|
1526
|
-
{
|
1445
|
+
int offset_docnum) {
|
1527
1446
|
int i, count = 0;
|
1528
1447
|
FrtMultiSearcher *msea = MSEA(self);
|
1529
1448
|
|
@@ -1574,8 +1493,7 @@ struct MultiSearchArg {
|
|
1574
1493
|
|
1575
1494
|
/*
|
1576
1495
|
* FIXME Not used anywhere. Is it needed?
|
1577
|
-
static void msea_search_i(FrtSearcher *self, int doc_num, float score, void *arg)
|
1578
|
-
{
|
1496
|
+
static void msea_search_i(FrtSearcher *self, int doc_num, float score, void *arg) {
|
1579
1497
|
struct MultiSearchArg *ms_arg = (struct MultiSearchArg *)arg;
|
1580
1498
|
FrtHit hit;
|
1581
1499
|
(void)self;
|