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
@@ -3,27 +3,23 @@
|
|
3
3
|
|
4
4
|
typedef void *(*alloc_ft)(size_t);
|
5
5
|
|
6
|
-
static void huge_emalloc(void *data)
|
7
|
-
{
|
6
|
+
static void huge_emalloc(void *data) {
|
8
7
|
(void)data;
|
9
8
|
frt_emalloc((size_t)-1);
|
10
9
|
}
|
11
10
|
|
12
|
-
static void huge_ecalloc(void *data)
|
13
|
-
{
|
11
|
+
static void huge_ecalloc(void *data) {
|
14
12
|
(void)data;
|
15
13
|
frt_ecalloc((size_t)-1);
|
16
14
|
}
|
17
15
|
|
18
|
-
static void huge_erealloc(void *data)
|
19
|
-
{
|
16
|
+
static void huge_erealloc(void *data) {
|
20
17
|
char *p = NULL;
|
21
18
|
(void)data;
|
22
19
|
frt_erealloc(p, (size_t)-1);
|
23
20
|
}
|
24
21
|
|
25
|
-
static void test_emalloc(TestCase *tc, void *data)
|
26
|
-
{
|
22
|
+
static void test_emalloc(TestCase *tc, void *data) {
|
27
23
|
char *p;
|
28
24
|
(void)data; /* suppress warning */
|
29
25
|
|
@@ -34,8 +30,7 @@ static void test_emalloc(TestCase *tc, void *data)
|
|
34
30
|
Araise(FRT_MEM_ERROR, huge_emalloc, NULL);
|
35
31
|
}
|
36
32
|
|
37
|
-
static void test_ecalloc(TestCase *tc, void *data)
|
38
|
-
{
|
33
|
+
static void test_ecalloc(TestCase *tc, void *data) {
|
39
34
|
int i;
|
40
35
|
char *p;
|
41
36
|
(void)data; /* suppress warning */
|
@@ -50,8 +45,7 @@ static void test_ecalloc(TestCase *tc, void *data)
|
|
50
45
|
Araise(FRT_MEM_ERROR, huge_ecalloc, NULL);
|
51
46
|
}
|
52
47
|
|
53
|
-
static void test_erealloc(TestCase *tc, void *data)
|
54
|
-
{
|
48
|
+
static void test_erealloc(TestCase *tc, void *data) {
|
55
49
|
char *p = NULL;
|
56
50
|
(void)data; /* suppress warning */
|
57
51
|
|
@@ -62,8 +56,7 @@ static void test_erealloc(TestCase *tc, void *data)
|
|
62
56
|
Araise(FRT_MEM_ERROR, huge_erealloc, NULL);
|
63
57
|
}
|
64
58
|
|
65
|
-
TestSuite *ts_lang(TestSuite *suite)
|
66
|
-
{
|
59
|
+
TestSuite *ts_lang(TestSuite *suite) {
|
67
60
|
suite = ADD_SUITE(suite);
|
68
61
|
|
69
62
|
tst_run_test(suite, test_emalloc, NULL);
|
@@ -6,12 +6,9 @@
|
|
6
6
|
* Test a MDBX store
|
7
7
|
*/
|
8
8
|
TestSuite *ts_mdbx_store(TestSuite *suite) {
|
9
|
-
#if defined POSH_OS_WIN32 || defined POSH_OS_WIN64
|
10
|
-
FrtStore *store = frt_open_mdbx_store(".\\test\\testdir\\mdbx_store");
|
11
|
-
#else
|
12
9
|
FrtStore *store = frt_open_mdbx_store("./test/testdir/mdbx_store");
|
13
|
-
|
14
|
-
store->clear(store);
|
10
|
+
store->create_folder(store, segm_idx_name);
|
11
|
+
store->clear(store, segm_idx_name);
|
15
12
|
suite = ADD_SUITE(suite);
|
16
13
|
create_test_store_suite(suite, store);
|
17
14
|
frt_store_close(store);
|
@@ -3,8 +3,7 @@
|
|
3
3
|
#include "frt_mempool.h"
|
4
4
|
|
5
5
|
|
6
|
-
static void test_mp_default_capa(TestCase *tc, void *data)
|
7
|
-
{
|
6
|
+
static void test_mp_default_capa(TestCase *tc, void *data) {
|
8
7
|
FrtMemoryPool *mp = frt_mp_new();
|
9
8
|
(void)data;
|
10
9
|
Aiequal(FRT_MP_INIT_CAPA, mp->buf_capa);
|
@@ -19,8 +18,7 @@ struct MemChecker {
|
|
19
18
|
#define NUM_ALLOCS 10000
|
20
19
|
#define MAX_SIZE 100
|
21
20
|
|
22
|
-
static void do_mp_test(TestCase *tc, FrtMemoryPool *mp)
|
23
|
-
{
|
21
|
+
static void do_mp_test(TestCase *tc, FrtMemoryPool *mp) {
|
24
22
|
int i, j;
|
25
23
|
int max_necessary;
|
26
24
|
int total_bytes = 0;
|
@@ -57,8 +55,7 @@ static void do_mp_test(TestCase *tc, FrtMemoryPool *mp)
|
|
57
55
|
}
|
58
56
|
}
|
59
57
|
|
60
|
-
static void test_mp_dup(TestCase *tc, void *data)
|
61
|
-
{
|
58
|
+
static void test_mp_dup(TestCase *tc, void *data) {
|
62
59
|
FrtMemoryPool *mp = frt_mp_new_capa(2000, 16);
|
63
60
|
(void)data;
|
64
61
|
|
@@ -68,8 +65,7 @@ static void test_mp_dup(TestCase *tc, void *data)
|
|
68
65
|
frt_mp_destroy(mp);
|
69
66
|
}
|
70
67
|
|
71
|
-
static void test_mp_alloc(TestCase *tc, void *data)
|
72
|
-
{
|
68
|
+
static void test_mp_alloc(TestCase *tc, void *data) {
|
73
69
|
FrtMemoryPool *mp = frt_mp_new_capa(20, 16);
|
74
70
|
char *t;
|
75
71
|
(void)data;
|
@@ -90,8 +86,7 @@ static void test_mp_alloc(TestCase *tc, void *data)
|
|
90
86
|
frt_mp_destroy(mp);
|
91
87
|
}
|
92
88
|
|
93
|
-
TestSuite *ts_mem_pool(TestSuite *suite)
|
94
|
-
{
|
89
|
+
TestSuite *ts_mem_pool(TestSuite *suite) {
|
95
90
|
suite = ADD_SUITE(suite);
|
96
91
|
|
97
92
|
tst_run_test(suite, test_mp_default_capa, NULL);
|
@@ -2,8 +2,7 @@
|
|
2
2
|
#include "frt_multimapper.h"
|
3
3
|
#include "test.h"
|
4
4
|
|
5
|
-
static void test_multimapper(TestCase *tc, void *data)
|
6
|
-
{
|
5
|
+
static void test_multimapper(TestCase *tc, void *data) {
|
7
6
|
char text[] = "abc cabc abd cabcd";
|
8
7
|
char dest[1000];
|
9
8
|
FrtMultiMapper *mapper = frt_mulmap_new();
|
@@ -29,8 +28,7 @@ static void test_multimapper(TestCase *tc, void *data)
|
|
29
28
|
frt_mulmap_destroy(mapper);
|
30
29
|
}
|
31
30
|
|
32
|
-
static void test_multimapper_utf8(TestCase *tc, void *data)
|
33
|
-
{
|
31
|
+
static void test_multimapper_utf8(TestCase *tc, void *data) {
|
34
32
|
char text[] = "zàáâãäåāăz";
|
35
33
|
char dest[1000];
|
36
34
|
char *dest_dynamic;
|
@@ -53,8 +51,7 @@ static void test_multimapper_utf8(TestCase *tc, void *data)
|
|
53
51
|
frt_mulmap_destroy(mapper);
|
54
52
|
}
|
55
53
|
|
56
|
-
TestSuite *ts_multimapper(TestSuite *suite)
|
57
|
-
{
|
54
|
+
TestSuite *ts_multimapper(TestSuite *suite) {
|
58
55
|
suite = ADD_SUITE(suite);
|
59
56
|
|
60
57
|
tst_run_test(suite, test_multimapper, NULL);
|
@@ -7,21 +7,18 @@
|
|
7
7
|
* Simple string less than function used for testing adding of strings to the
|
8
8
|
* priority queue.
|
9
9
|
*/
|
10
|
-
static bool str_lt(void *p1, void *p2)
|
11
|
-
{
|
10
|
+
static bool str_lt(void *p1, void *p2) {
|
12
11
|
return (strcmp((char *) p1, (char *) p2) < 0);
|
13
12
|
}
|
14
13
|
|
15
|
-
static bool str_lt_rev(void *p1, void *p2)
|
16
|
-
{
|
14
|
+
static bool str_lt_rev(void *p1, void *p2) {
|
17
15
|
return (strcmp((char *) p1, (char *) p2) > 0);
|
18
16
|
}
|
19
17
|
|
20
18
|
/**
|
21
19
|
* Test basic FrtPriorityQueue functions.
|
22
20
|
*/
|
23
|
-
static void test_pq(TestCase *tc, void *data)
|
24
|
-
{
|
21
|
+
static void test_pq(TestCase *tc, void *data) {
|
25
22
|
char *tmp;
|
26
23
|
FrtPriorityQueue *pq = frt_pq_new(4, (frt_lt_ft)&str_lt, &free);
|
27
24
|
(void)data; /* suppress unused argument warning */
|
@@ -58,8 +55,7 @@ static void test_pq(TestCase *tc, void *data)
|
|
58
55
|
/**
|
59
56
|
* Test basic FrtPriorityQueue functions.
|
60
57
|
*/
|
61
|
-
static void test_pq_reverse(TestCase *tc, void *data)
|
62
|
-
{
|
58
|
+
static void test_pq_reverse(TestCase *tc, void *data) {
|
63
59
|
char *tmp;
|
64
60
|
FrtPriorityQueue *pq = frt_pq_new(4, (frt_lt_ft)&str_lt_rev, &free);
|
65
61
|
(void)data; /* suppress unused argument warning */
|
@@ -97,8 +93,7 @@ static void test_pq_reverse(TestCase *tc, void *data)
|
|
97
93
|
* Free mock used to test that the FrtPriorityQueue is being destroyed correctly
|
98
94
|
* including it's elements
|
99
95
|
*/
|
100
|
-
static void pq_free_mock(void *p)
|
101
|
-
{
|
96
|
+
static void pq_free_mock(void *p) {
|
102
97
|
char *str = (char *) p;
|
103
98
|
strcpy(str, "free");
|
104
99
|
}
|
@@ -106,8 +101,7 @@ static void pq_free_mock(void *p)
|
|
106
101
|
/**
|
107
102
|
* Test pq_clear function
|
108
103
|
*/
|
109
|
-
static void test_pq_clear(TestCase *tc, void *data)
|
110
|
-
{
|
104
|
+
static void test_pq_clear(TestCase *tc, void *data) {
|
111
105
|
char word1[10] = "word1";
|
112
106
|
char word2[10] = "word2";
|
113
107
|
char word3[10] = "word3";
|
@@ -131,8 +125,7 @@ static void test_pq_clear(TestCase *tc, void *data)
|
|
131
125
|
* insert more than the PriorityQueue's capacity, the extra elements that drop
|
132
126
|
* off the bottom are destroyed.
|
133
127
|
*/
|
134
|
-
static void test_pq_insert_overflow(TestCase *tc, void *data)
|
135
|
-
{
|
128
|
+
static void test_pq_insert_overflow(TestCase *tc, void *data) {
|
136
129
|
char word1[10] = "word1";
|
137
130
|
char word2[10] = "word2";
|
138
131
|
char word3[10] = "word3";
|
@@ -168,8 +161,7 @@ static void test_pq_insert_overflow(TestCase *tc, void *data)
|
|
168
161
|
* to really stress test PriorityQueue.
|
169
162
|
*/
|
170
163
|
#define PQ_STRESS_SIZE 1000
|
171
|
-
static void stress_pq(TestCase *tc, void *data)
|
172
|
-
{
|
164
|
+
static void stress_pq(TestCase *tc, void *data) {
|
173
165
|
int i;
|
174
166
|
char buf[100], *prev, *curr;
|
175
167
|
FrtPriorityQueue *pq = frt_pq_new(PQ_STRESS_SIZE, (frt_lt_ft)&str_lt, &free);
|
@@ -199,8 +191,7 @@ static void stress_pq(TestCase *tc, void *data)
|
|
199
191
|
/**
|
200
192
|
* PriorityQueue's test suite
|
201
193
|
*/
|
202
|
-
TestSuite *ts_priorityqueue(TestSuite *suite)
|
203
|
-
{
|
194
|
+
TestSuite *ts_priorityqueue(TestSuite *suite) {
|
204
195
|
suite = ADD_SUITE(suite);
|
205
196
|
|
206
197
|
tst_run_test(suite, test_pq, NULL);
|
@@ -7,8 +7,7 @@ static ID num;
|
|
7
7
|
|
8
8
|
extern void prepare_filter_index(FrtStore *store);
|
9
9
|
|
10
|
-
static void test_const_score_query(TestCase *tc, void *data)
|
11
|
-
{
|
10
|
+
static void test_const_score_query(TestCase *tc, void *data) {
|
12
11
|
FrtSearcher *searcher = (FrtSearcher *)data;
|
13
12
|
FrtQuery *q;
|
14
13
|
q = frt_csq_new_nr(frt_rfilt_new(num, "2", "6", true, true));
|
@@ -37,8 +36,7 @@ static void test_const_score_query(TestCase *tc, void *data)
|
|
37
36
|
frt_q_deref(q);
|
38
37
|
}
|
39
38
|
|
40
|
-
static void test_const_score_query_hash(TestCase *tc, void *data)
|
41
|
-
{
|
39
|
+
static void test_const_score_query_hash(TestCase *tc, void *data) {
|
42
40
|
FrtFilter *f;
|
43
41
|
FrtQuery *q1, *q2;
|
44
42
|
(void)data;
|
@@ -63,9 +61,9 @@ static void test_const_score_query_hash(TestCase *tc, void *data)
|
|
63
61
|
frt_q_deref(q1);
|
64
62
|
}
|
65
63
|
|
66
|
-
TestSuite *ts_q_const_score(TestSuite *suite)
|
67
|
-
{
|
64
|
+
TestSuite *ts_q_const_score(TestSuite *suite) {
|
68
65
|
FrtStore *store = frt_open_ram_store(NULL);
|
66
|
+
store->create_folder(store, segm_idx_name);
|
69
67
|
FrtIndexReader *ir;
|
70
68
|
FrtSearcher *searcher;
|
71
69
|
|
@@ -7,8 +7,7 @@ static ID num, flipflop;
|
|
7
7
|
|
8
8
|
extern void prepare_filter_index(FrtStore *store);
|
9
9
|
|
10
|
-
static void test_filtered_query(TestCase *tc, void *data)
|
11
|
-
{
|
10
|
+
static void test_filtered_query(TestCase *tc, void *data) {
|
12
11
|
FrtSearcher *searcher = (FrtSearcher *)data;
|
13
12
|
FrtQuery *q;
|
14
13
|
q = frt_fq_new(frt_maq_new(), frt_rfilt_new(num, "2", "6", true, true));
|
@@ -40,9 +39,9 @@ static void test_filtered_query(TestCase *tc, void *data)
|
|
40
39
|
frt_q_deref(q);
|
41
40
|
}
|
42
41
|
|
43
|
-
TestSuite *ts_q_filtered(TestSuite *suite)
|
44
|
-
{
|
42
|
+
TestSuite *ts_q_filtered(TestSuite *suite) {
|
45
43
|
FrtStore *store = frt_open_ram_store(NULL);
|
44
|
+
store->create_folder(store, segm_idx_name);
|
46
45
|
FrtIndexReader *ir;
|
47
46
|
FrtSearcher *searcher;
|
48
47
|
|
@@ -7,26 +7,23 @@
|
|
7
7
|
|
8
8
|
static ID field;
|
9
9
|
|
10
|
-
static void add_doc(const char *text, FrtIndexWriter *iw)
|
11
|
-
{
|
10
|
+
static void add_doc(const char *text, FrtIndexWriter *iw) {
|
12
11
|
FrtDocument *doc = frt_doc_new();
|
13
12
|
rb_encoding *enc = rb_enc_find("ASCII-8BIT");
|
14
|
-
frt_doc_add_field(doc, frt_df_add_data(frt_df_new(field),
|
13
|
+
frt_doc_add_field(doc, frt_df_add_data(frt_df_new(field), text, enc));
|
15
14
|
frt_iw_add_doc(iw, doc);
|
16
15
|
frt_doc_destroy(doc);
|
17
16
|
}
|
18
17
|
|
19
18
|
void check_to_s(TestCase *tc, FrtQuery *query, ID field, const char *q_str);
|
20
19
|
|
21
|
-
static void do_prefix_test(TestCase *tc, FrtSearcher *searcher, const char *qstr, const char *expected_hits, int pre_len, float min_sim)
|
22
|
-
{
|
20
|
+
static void do_prefix_test(TestCase *tc, FrtSearcher *searcher, const char *qstr, const char *expected_hits, int pre_len, float min_sim) {
|
23
21
|
FrtQuery *fq = frt_fuzq_new_conf(field, qstr, min_sim, pre_len, 10);
|
24
22
|
tst_check_hits(tc, searcher, fq, expected_hits, -1);
|
25
23
|
frt_q_deref(fq);
|
26
24
|
}
|
27
25
|
|
28
|
-
static void test_fuzziness(TestCase *tc, void *data)
|
29
|
-
{
|
26
|
+
static void test_fuzziness(TestCase *tc, void *data) {
|
30
27
|
FrtStore *store = (FrtStore *)data;
|
31
28
|
FrtIndexWriter *iw;
|
32
29
|
FrtIndexReader *ir;
|
@@ -113,8 +110,7 @@ static void test_fuzziness(TestCase *tc, void *data)
|
|
113
110
|
frt_ir_close(ir);
|
114
111
|
}
|
115
112
|
|
116
|
-
static void test_fuzziness_long(TestCase *tc, void *data)
|
117
|
-
{
|
113
|
+
static void test_fuzziness_long(TestCase *tc, void *data) {
|
118
114
|
FrtStore *store = (FrtStore *)data;
|
119
115
|
FrtIndexWriter *iw;
|
120
116
|
FrtSearcher *sea;
|
@@ -172,8 +168,7 @@ static void test_fuzziness_long(TestCase *tc, void *data)
|
|
172
168
|
/**
|
173
169
|
* Test query->to_s functionality
|
174
170
|
*/
|
175
|
-
static void test_fuzzy_query_to_s(TestCase *tc, void *data)
|
176
|
-
{
|
171
|
+
static void test_fuzzy_query_to_s(TestCase *tc, void *data) {
|
177
172
|
FrtQuery *q;
|
178
173
|
(void)data;
|
179
174
|
|
@@ -192,8 +187,7 @@ static void test_fuzzy_query_to_s(TestCase *tc, void *data)
|
|
192
187
|
/**
|
193
188
|
* Test query hashing functionality
|
194
189
|
*/
|
195
|
-
static void test_fuzzy_query_hash(TestCase *tc, void *data)
|
196
|
-
{
|
190
|
+
static void test_fuzzy_query_hash(TestCase *tc, void *data) {
|
197
191
|
FrtQuery *q1, *q2;
|
198
192
|
(void)data;
|
199
193
|
|
@@ -228,9 +222,9 @@ static void test_fuzzy_query_hash(TestCase *tc, void *data)
|
|
228
222
|
frt_q_deref(q1);
|
229
223
|
}
|
230
224
|
|
231
|
-
TestSuite *ts_q_fuzzy(TestSuite *suite)
|
232
|
-
{
|
225
|
+
TestSuite *ts_q_fuzzy(TestSuite *suite) {
|
233
226
|
FrtStore *store = frt_open_ram_store(NULL);
|
227
|
+
store->create_folder(store, segm_idx_name);
|
234
228
|
|
235
229
|
field = rb_intern("field");
|
236
230
|
|
@@ -16,8 +16,7 @@ typedef struct QPTestPair {
|
|
16
16
|
free(qres);\
|
17
17
|
} while (0);
|
18
18
|
|
19
|
-
static void test_q_parser(TestCase *tc, void *data)
|
20
|
-
{
|
19
|
+
static void test_q_parser(TestCase *tc, void *data) {
|
21
20
|
int i;
|
22
21
|
FrtAnalyzer *analyzer = frt_letter_analyzer_new(true);
|
23
22
|
FrtQParser *parser;
|
@@ -185,8 +184,7 @@ static void test_q_parser(TestCase *tc, void *data)
|
|
185
184
|
frt_qp_destroy(parser);
|
186
185
|
}
|
187
186
|
|
188
|
-
static void test_q_parser_standard_analyzer(TestCase *tc, void *data)
|
189
|
-
{
|
187
|
+
static void test_q_parser_standard_analyzer(TestCase *tc, void *data) {
|
190
188
|
int i;
|
191
189
|
FrtAnalyzer *analyzer = frt_standard_analyzer_new(true);
|
192
190
|
FrtQParser *parser;
|
@@ -352,8 +350,7 @@ static void test_q_parser_standard_analyzer(TestCase *tc, void *data)
|
|
352
350
|
frt_qp_destroy(parser);
|
353
351
|
}
|
354
352
|
|
355
|
-
static void test_qp_clean_str(TestCase *tc, void *data)
|
356
|
-
{
|
353
|
+
static void test_qp_clean_str(TestCase *tc, void *data) {
|
357
354
|
int i;
|
358
355
|
QPTestPair pairs[] = {
|
359
356
|
{"", ""},
|
@@ -382,8 +379,7 @@ static void test_qp_clean_str(TestCase *tc, void *data)
|
|
382
379
|
}
|
383
380
|
}
|
384
381
|
|
385
|
-
static void test_qp_bad_queries(TestCase *tc, void *data)
|
386
|
-
{
|
382
|
+
static void test_qp_bad_queries(TestCase *tc, void *data) {
|
387
383
|
int i;
|
388
384
|
FrtQParser *parser;
|
389
385
|
QPTestPair pairs[] = {
|
@@ -413,8 +409,7 @@ static void test_qp_bad_queries(TestCase *tc, void *data)
|
|
413
409
|
frt_qp_destroy(parser);
|
414
410
|
}
|
415
411
|
|
416
|
-
static void test_mb_qp_bad_queries(TestCase *tc, void *data)
|
417
|
-
{
|
412
|
+
static void test_mb_qp_bad_queries(TestCase *tc, void *data) {
|
418
413
|
int i;
|
419
414
|
FrtQParser *parser;
|
420
415
|
QPTestPair pairs[] = {
|
@@ -444,8 +439,7 @@ static void test_mb_qp_bad_queries(TestCase *tc, void *data)
|
|
444
439
|
frt_qp_destroy(parser);
|
445
440
|
}
|
446
441
|
|
447
|
-
static void test_qp_prefix_query(TestCase *tc, void *data)
|
448
|
-
{
|
442
|
+
static void test_qp_prefix_query(TestCase *tc, void *data) {
|
449
443
|
FrtQParser *parser;
|
450
444
|
FrtQuery *q;
|
451
445
|
(void)data;
|
@@ -469,8 +463,7 @@ static void test_qp_prefix_query(TestCase *tc, void *data)
|
|
469
463
|
frt_qp_destroy(parser);
|
470
464
|
}
|
471
465
|
|
472
|
-
static void test_qp_keyword_switch(TestCase *tc, void *data)
|
473
|
-
{
|
466
|
+
static void test_qp_keyword_switch(TestCase *tc, void *data) {
|
474
467
|
FrtQParser *parser;
|
475
468
|
(void)data;
|
476
469
|
rb_encoding *enc = rb_enc_find("ASCII-8BIT");
|
@@ -486,8 +479,7 @@ static void test_qp_keyword_switch(TestCase *tc, void *data)
|
|
486
479
|
frt_qp_destroy(parser);
|
487
480
|
}
|
488
481
|
|
489
|
-
TestSuite *ts_q_parser(TestSuite *suite)
|
490
|
-
{
|
482
|
+
TestSuite *ts_q_parser(TestSuite *suite) {
|
491
483
|
suite = ADD_SUITE(suite);
|
492
484
|
|
493
485
|
tst_run_test(suite, test_q_parser, NULL);
|
@@ -14,18 +14,16 @@
|
|
14
14
|
|
15
15
|
static ID field;
|
16
16
|
|
17
|
-
static void add_doc(const char *text, FrtIndexWriter *iw)
|
18
|
-
{
|
17
|
+
static void add_doc(const char *text, FrtIndexWriter *iw) {
|
19
18
|
FrtDocument *doc = frt_doc_new();
|
20
19
|
rb_encoding *enc = rb_enc_find("ASCII-8BIT");
|
21
|
-
frt_doc_add_field(doc, frt_df_add_data(frt_df_new(field),
|
20
|
+
frt_doc_add_field(doc, frt_df_add_data(frt_df_new(field), text, enc));
|
22
21
|
frt_iw_add_doc(iw, doc);
|
23
22
|
frt_doc_destroy(doc);
|
24
23
|
}
|
25
24
|
|
26
25
|
|
27
|
-
static void span_test_setup(FrtStore *store)
|
28
|
-
{
|
26
|
+
static void span_test_setup(FrtStore *store) {
|
29
27
|
const char **d;
|
30
28
|
FrtIndexWriter *iw;
|
31
29
|
FrtFieldInfos *fis = frt_fis_new(0 | FRT_FI_IS_STORED_BM | FRT_FI_IS_INDEXED_BM | FRT_FI_IS_TOKENIZED_BM | FRT_FI_STORE_TERM_VECTOR_BM);
|
@@ -74,8 +72,7 @@ static void span_test_setup(FrtStore *store)
|
|
74
72
|
frt_iw_close(iw);
|
75
73
|
}
|
76
74
|
|
77
|
-
static void test_span_term(TestCase *tc, void *data)
|
78
|
-
{
|
75
|
+
static void test_span_term(TestCase *tc, void *data) {
|
79
76
|
FrtStore *store = (FrtStore *)data;
|
80
77
|
FrtIndexReader *ir;
|
81
78
|
FrtSearcher *sea;
|
@@ -103,8 +100,7 @@ static void test_span_term(TestCase *tc, void *data)
|
|
103
100
|
frt_ir_close(ir);
|
104
101
|
}
|
105
102
|
|
106
|
-
static void test_span_term_hash(TestCase *tc, void *data)
|
107
|
-
{
|
103
|
+
static void test_span_term_hash(TestCase *tc, void *data) {
|
108
104
|
FrtQuery *q1, *q2;
|
109
105
|
(void)data;
|
110
106
|
|
@@ -129,8 +125,7 @@ static void test_span_term_hash(TestCase *tc, void *data)
|
|
129
125
|
frt_q_deref(q1);
|
130
126
|
}
|
131
127
|
|
132
|
-
static void test_span_multi_term(TestCase *tc, void *data)
|
133
|
-
{
|
128
|
+
static void test_span_multi_term(TestCase *tc, void *data) {
|
134
129
|
FrtStore *store = (FrtStore *)data;
|
135
130
|
FrtIndexReader *ir;
|
136
131
|
FrtSearcher *sea;
|
@@ -173,8 +168,7 @@ static void test_span_multi_term(TestCase *tc, void *data)
|
|
173
168
|
frt_ir_close(ir);
|
174
169
|
}
|
175
170
|
|
176
|
-
static void test_span_multi_term_hash(TestCase *tc, void *data)
|
177
|
-
{
|
171
|
+
static void test_span_multi_term_hash(TestCase *tc, void *data) {
|
178
172
|
FrtQuery *q1 = frt_spanmtq_new_conf(field, 100);
|
179
173
|
FrtQuery *q2 = frt_spanmtq_new(field);
|
180
174
|
(void)data, (void)tc;
|
@@ -203,8 +197,7 @@ static void test_span_multi_term_hash(TestCase *tc, void *data)
|
|
203
197
|
frt_q_deref(q2);
|
204
198
|
}
|
205
199
|
|
206
|
-
static void test_span_prefix(TestCase *tc, void *data)
|
207
|
-
{
|
200
|
+
static void test_span_prefix(TestCase *tc, void *data) {
|
208
201
|
FrtStore *store = (FrtStore *)data;
|
209
202
|
FrtIndexReader *ir;
|
210
203
|
FrtSearcher *sea;
|
@@ -235,8 +228,7 @@ static void test_span_prefix(TestCase *tc, void *data)
|
|
235
228
|
frt_ir_close(ir);
|
236
229
|
}
|
237
230
|
|
238
|
-
static void test_span_prefix_hash(TestCase *tc, void *data)
|
239
|
-
{
|
231
|
+
static void test_span_prefix_hash(TestCase *tc, void *data) {
|
240
232
|
FrtQuery *q1, *q2;
|
241
233
|
(void)data;
|
242
234
|
q1 = frt_spanprq_new(rb_intern("A"), "a");
|
@@ -260,8 +252,7 @@ static void test_span_prefix_hash(TestCase *tc, void *data)
|
|
260
252
|
frt_q_deref(q1);
|
261
253
|
}
|
262
254
|
|
263
|
-
static void test_span_first(TestCase *tc, void *data)
|
264
|
-
{
|
255
|
+
static void test_span_first(TestCase *tc, void *data) {
|
265
256
|
FrtStore *store = (FrtStore *)data;
|
266
257
|
FrtIndexReader *ir;
|
267
258
|
FrtSearcher *sea;
|
@@ -285,8 +276,7 @@ static void test_span_first(TestCase *tc, void *data)
|
|
285
276
|
frt_ir_close(ir);
|
286
277
|
}
|
287
278
|
|
288
|
-
static void test_span_first_hash(TestCase *tc, void *data)
|
289
|
-
{
|
279
|
+
static void test_span_first_hash(TestCase *tc, void *data) {
|
290
280
|
FrtQuery *q1, *q2;
|
291
281
|
(void)data;
|
292
282
|
|
@@ -311,8 +301,7 @@ static void test_span_first_hash(TestCase *tc, void *data)
|
|
311
301
|
frt_q_deref(q1);
|
312
302
|
}
|
313
303
|
|
314
|
-
static void test_span_or(TestCase *tc, void *data)
|
315
|
-
{
|
304
|
+
static void test_span_or(TestCase *tc, void *data) {
|
316
305
|
FrtStore *store = (FrtStore *)data;
|
317
306
|
FrtIndexReader *ir;
|
318
307
|
FrtSearcher *sea;
|
@@ -334,8 +323,7 @@ static void test_span_or(TestCase *tc, void *data)
|
|
334
323
|
frt_ir_close(ir);
|
335
324
|
}
|
336
325
|
|
337
|
-
static void test_span_or_hash(TestCase *tc, void *data)
|
338
|
-
{
|
326
|
+
static void test_span_or_hash(TestCase *tc, void *data) {
|
339
327
|
FrtQuery *q1, *q2;
|
340
328
|
(void)data;
|
341
329
|
|
@@ -366,8 +354,7 @@ static void test_span_or_hash(TestCase *tc, void *data)
|
|
366
354
|
frt_q_deref(q1);
|
367
355
|
}
|
368
356
|
|
369
|
-
static void test_span_near(TestCase *tc, void *data)
|
370
|
-
{
|
357
|
+
static void test_span_near(TestCase *tc, void *data) {
|
371
358
|
FrtStore *store = (FrtStore *)data;
|
372
359
|
FrtIndexReader *ir;
|
373
360
|
FrtSearcher *sea;
|
@@ -415,8 +402,7 @@ static void test_span_near(TestCase *tc, void *data)
|
|
415
402
|
frt_ir_close(ir);
|
416
403
|
}
|
417
404
|
|
418
|
-
static void test_span_near_hash(TestCase *tc, void *data)
|
419
|
-
{
|
405
|
+
static void test_span_near_hash(TestCase *tc, void *data) {
|
420
406
|
FrtQuery *q1, *q2;
|
421
407
|
(void)data;
|
422
408
|
|
@@ -468,8 +454,7 @@ static void test_span_near_hash(TestCase *tc, void *data)
|
|
468
454
|
frt_q_deref(q1);
|
469
455
|
}
|
470
456
|
|
471
|
-
static void test_span_not(TestCase *tc, void *data)
|
472
|
-
{
|
457
|
+
static void test_span_not(TestCase *tc, void *data) {
|
473
458
|
FrtStore *store = (FrtStore *)data;
|
474
459
|
FrtIndexReader *ir;
|
475
460
|
FrtSearcher *sea;
|
@@ -523,8 +508,7 @@ static void test_span_not(TestCase *tc, void *data)
|
|
523
508
|
frt_ir_close(ir);
|
524
509
|
}
|
525
510
|
|
526
|
-
static void test_span_not_hash(TestCase *tc, void *data)
|
527
|
-
{
|
511
|
+
static void test_span_not_hash(TestCase *tc, void *data) {
|
528
512
|
FrtQuery *q1, *q2;
|
529
513
|
(void)data;
|
530
514
|
|
@@ -559,9 +543,9 @@ static void test_span_not_hash(TestCase *tc, void *data)
|
|
559
543
|
frt_q_deref(q1);
|
560
544
|
}
|
561
545
|
|
562
|
-
TestSuite *ts_q_span(TestSuite *suite)
|
563
|
-
{
|
546
|
+
TestSuite *ts_q_span(TestSuite *suite) {
|
564
547
|
FrtStore *store = frt_open_ram_store(NULL);
|
548
|
+
store->create_folder(store, segm_idx_name);
|
565
549
|
field = rb_intern("field");
|
566
550
|
span_test_setup(store);
|
567
551
|
|
@@ -6,54 +6,55 @@
|
|
6
6
|
* Test ramo_write_to which basically writes the contents of a RAM output
|
7
7
|
* stream to another output stream, usually a FileSystem output stream.
|
8
8
|
*/
|
9
|
-
void test_write_to(TestCase *tc, void *data)
|
10
|
-
{
|
9
|
+
void test_write_to(TestCase *tc, void *data) {
|
11
10
|
int i;
|
12
11
|
char *tmp;
|
13
12
|
FrtStore *ram_store = frt_open_ram_store(NULL);
|
13
|
+
ram_store->create_folder(ram_store, segm_idx_name);
|
14
14
|
FrtStore *fs_store = frt_open_mdbx_store("./test/testdir/store");
|
15
|
+
fs_store->create_folder(fs_store, segm_idx_name);
|
15
16
|
char str[18] = "³³ øãíøäÄ";
|
16
17
|
char buf[18000] = "";
|
17
18
|
FrtOutStream *ostream, *fs_ostream;
|
18
19
|
FrtInStream *istream;
|
19
20
|
(void)data;/* suppress unused parameter warning */
|
20
21
|
|
21
|
-
fs_store->clear(fs_store);
|
22
|
+
fs_store->clear(fs_store, segm_idx_name);
|
22
23
|
|
23
24
|
for (i = 0; i < 1000; i++) {
|
24
25
|
strcat(buf, str);
|
25
26
|
}
|
26
27
|
|
27
|
-
ostream = ram_store->new_output(ram_store, "_rw_funny_string.
|
28
|
+
ostream = ram_store->new_output(ram_store, segm_idx_name, "_rw_funny_string.fdt");
|
28
29
|
frt_os_write_string(ostream, str);
|
29
30
|
frt_os_write_string(ostream, buf);
|
30
31
|
|
31
|
-
fs_ostream = fs_store->new_output(fs_store, "_rw_funny_string.
|
32
|
+
fs_ostream = fs_store->new_output(fs_store, segm_idx_name, "_rw_funny_string.fdt");
|
32
33
|
frt_ramo_write_to(ostream, fs_ostream);
|
33
34
|
|
34
35
|
frt_os_close(ostream);
|
35
36
|
frt_os_close(fs_ostream);
|
36
37
|
|
37
|
-
istream = fs_store->open_input(fs_store, "_rw_funny_string.
|
38
|
+
istream = fs_store->open_input(fs_store, segm_idx_name, "_rw_funny_string.fdt");
|
38
39
|
Asequal(str, tmp = frt_is_read_string(istream));
|
39
40
|
free(tmp);
|
40
41
|
Asequal(buf, tmp = frt_is_read_string(istream));
|
41
42
|
free(tmp);
|
42
43
|
frt_is_close(istream);
|
43
44
|
|
44
|
-
Aiequal(17021, fs_store->length(fs_store, "_rw_funny_string.
|
45
|
+
Aiequal(17021, fs_store->length(fs_store, segm_idx_name, "_rw_funny_string.fdt"));
|
45
46
|
frt_store_close(ram_store);
|
46
|
-
ram_store = frt_open_ram_store_and_copy(NULL, fs_store, false);
|
47
|
+
ram_store = frt_open_ram_store_and_copy(NULL, fs_store, segm_idx_name, false);
|
47
48
|
|
48
|
-
istream = ram_store->open_input(ram_store, "_rw_funny_string.
|
49
|
+
istream = ram_store->open_input(ram_store, segm_idx_name, "_rw_funny_string.fdt");
|
49
50
|
Asequal(str, tmp = frt_is_read_string(istream));
|
50
51
|
free(tmp);
|
51
52
|
Asequal(buf, tmp = frt_is_read_string(istream));
|
52
53
|
free(tmp);
|
53
54
|
frt_is_close(istream);
|
54
|
-
Aiequal(17021, ram_store->length(ram_store, "_rw_funny_string.
|
55
|
+
Aiequal(17021, ram_store->length(ram_store, segm_idx_name, "_rw_funny_string.fdt"));
|
55
56
|
|
56
|
-
fs_store->clear_all(fs_store);
|
57
|
+
fs_store->clear_all(fs_store, segm_idx_name);
|
57
58
|
frt_store_close(fs_store);
|
58
59
|
frt_store_close(ram_store);
|
59
60
|
}
|
@@ -61,9 +62,9 @@ void test_write_to(TestCase *tc, void *data)
|
|
61
62
|
/**
|
62
63
|
* Create the RAMStore test suite
|
63
64
|
*/
|
64
|
-
TestSuite *ts_ram_store(TestSuite *suite)
|
65
|
-
{
|
65
|
+
TestSuite *ts_ram_store(TestSuite *suite) {
|
66
66
|
FrtStore *store = frt_open_ram_store(NULL);
|
67
|
+
store->create_folder(store, segm_idx_name);
|
67
68
|
|
68
69
|
suite = ADD_SUITE(suite);
|
69
70
|
|