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.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/ext/isomorfeus_ferret_ext/benchmark.c +9 -20
  3. data/ext/isomorfeus_ferret_ext/benchmarks_all.h +1 -2
  4. data/ext/isomorfeus_ferret_ext/bm_hash.c +1 -2
  5. data/ext/isomorfeus_ferret_ext/brotli_dec_decode.c +4 -2
  6. data/ext/isomorfeus_ferret_ext/brotli_enc_encode.c +3 -2
  7. data/ext/isomorfeus_ferret_ext/frb_analysis.c +4 -5
  8. data/ext/isomorfeus_ferret_ext/frb_field_info.c +3 -4
  9. data/ext/isomorfeus_ferret_ext/frb_index.c +118 -125
  10. data/ext/isomorfeus_ferret_ext/frb_lazy_doc.c +14 -16
  11. data/ext/isomorfeus_ferret_ext/frb_search.c +31 -23
  12. data/ext/isomorfeus_ferret_ext/frb_store.c +27 -13
  13. data/ext/isomorfeus_ferret_ext/frb_utils.c +3 -6
  14. data/ext/isomorfeus_ferret_ext/frt_analysis.c +39 -46
  15. data/ext/isomorfeus_ferret_ext/frt_analysis.h +9 -9
  16. data/ext/isomorfeus_ferret_ext/frt_array.c +11 -22
  17. data/ext/isomorfeus_ferret_ext/frt_bitvector.h +3 -6
  18. data/ext/isomorfeus_ferret_ext/frt_doc_field.c +87 -0
  19. data/ext/isomorfeus_ferret_ext/frt_doc_field.h +26 -0
  20. data/ext/isomorfeus_ferret_ext/frt_document.c +4 -97
  21. data/ext/isomorfeus_ferret_ext/frt_document.h +2 -27
  22. data/ext/isomorfeus_ferret_ext/frt_except.c +8 -6
  23. data/ext/isomorfeus_ferret_ext/frt_except.h +1 -2
  24. data/ext/isomorfeus_ferret_ext/frt_field_index.c +13 -32
  25. data/ext/isomorfeus_ferret_ext/frt_field_index.h +0 -6
  26. data/ext/isomorfeus_ferret_ext/frt_field_info.c +69 -0
  27. data/ext/isomorfeus_ferret_ext/frt_field_info.h +49 -0
  28. data/ext/isomorfeus_ferret_ext/frt_field_infos.c +196 -0
  29. data/ext/isomorfeus_ferret_ext/frt_field_infos.h +35 -0
  30. data/ext/isomorfeus_ferret_ext/frt_global.c +10 -4
  31. data/ext/isomorfeus_ferret_ext/frt_global.h +11 -15
  32. data/ext/isomorfeus_ferret_ext/frt_hash.c +8 -8
  33. data/ext/isomorfeus_ferret_ext/frt_hash.h +1 -2
  34. data/ext/isomorfeus_ferret_ext/frt_hashset.c +20 -40
  35. data/ext/isomorfeus_ferret_ext/frt_hashset.h +1 -2
  36. data/ext/isomorfeus_ferret_ext/frt_helper.c +7 -15
  37. data/ext/isomorfeus_ferret_ext/frt_in_stream.c +35 -45
  38. data/ext/isomorfeus_ferret_ext/frt_in_stream.h +3 -2
  39. data/ext/isomorfeus_ferret_ext/frt_ind.c +20 -38
  40. data/ext/isomorfeus_ferret_ext/frt_index.c +292 -790
  41. data/ext/isomorfeus_ferret_ext/frt_index.h +1 -102
  42. data/ext/isomorfeus_ferret_ext/frt_lang.c +5 -10
  43. data/ext/isomorfeus_ferret_ext/frt_lazy_doc.c +3 -3
  44. data/ext/isomorfeus_ferret_ext/frt_lazy_doc.h +1 -1
  45. data/ext/isomorfeus_ferret_ext/frt_lazy_doc_field.c +18 -25
  46. data/ext/isomorfeus_ferret_ext/frt_lazy_doc_field.h +5 -5
  47. data/ext/isomorfeus_ferret_ext/frt_mdbx_store.c +102 -70
  48. data/ext/isomorfeus_ferret_ext/frt_mempool.c +8 -16
  49. data/ext/isomorfeus_ferret_ext/frt_multimapper.c +23 -46
  50. data/ext/isomorfeus_ferret_ext/frt_multimapper.h +4 -8
  51. data/ext/isomorfeus_ferret_ext/frt_out_stream.c +31 -43
  52. data/ext/isomorfeus_ferret_ext/frt_out_stream.h +2 -2
  53. data/ext/isomorfeus_ferret_ext/frt_posh.c +6 -819
  54. data/ext/isomorfeus_ferret_ext/frt_posh.h +0 -57
  55. data/ext/isomorfeus_ferret_ext/frt_priorityqueue.c +11 -22
  56. data/ext/isomorfeus_ferret_ext/frt_priorityqueue.h +1 -2
  57. data/ext/isomorfeus_ferret_ext/frt_q_boolean.c +85 -171
  58. data/ext/isomorfeus_ferret_ext/frt_q_match_all.c +8 -16
  59. data/ext/isomorfeus_ferret_ext/frt_q_multi_term.c +1 -2
  60. data/ext/isomorfeus_ferret_ext/frt_q_parser.c +49 -98
  61. data/ext/isomorfeus_ferret_ext/frt_q_phrase.c +52 -104
  62. data/ext/isomorfeus_ferret_ext/frt_q_range.c +6 -12
  63. data/ext/isomorfeus_ferret_ext/frt_q_span.c +113 -226
  64. data/ext/isomorfeus_ferret_ext/frt_q_wildcard.c +1 -2
  65. data/ext/isomorfeus_ferret_ext/frt_ram_store.c +134 -85
  66. data/ext/isomorfeus_ferret_ext/frt_search.c +82 -164
  67. data/ext/isomorfeus_ferret_ext/frt_similarity.c +11 -22
  68. data/ext/isomorfeus_ferret_ext/frt_similarity.h +1 -2
  69. data/ext/isomorfeus_ferret_ext/frt_store.c +13 -25
  70. data/ext/isomorfeus_ferret_ext/frt_store.h +86 -52
  71. data/ext/isomorfeus_ferret_ext/frt_term_vectors.c +8 -16
  72. data/ext/isomorfeus_ferret_ext/frt_win32.h +5 -10
  73. data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.c +12 -11
  74. data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.h +11 -13
  75. data/ext/isomorfeus_ferret_ext/lz4.c +422 -195
  76. data/ext/isomorfeus_ferret_ext/lz4.h +114 -46
  77. data/ext/isomorfeus_ferret_ext/lz4frame.c +421 -242
  78. data/ext/isomorfeus_ferret_ext/lz4frame.h +122 -53
  79. data/ext/isomorfeus_ferret_ext/lz4hc.c +127 -111
  80. data/ext/isomorfeus_ferret_ext/lz4hc.h +14 -14
  81. data/ext/isomorfeus_ferret_ext/lz4xxhash.h +1 -1
  82. data/ext/isomorfeus_ferret_ext/mdbx.c +3762 -2526
  83. data/ext/isomorfeus_ferret_ext/mdbx.h +115 -70
  84. data/ext/isomorfeus_ferret_ext/test.c +40 -87
  85. data/ext/isomorfeus_ferret_ext/test.h +3 -6
  86. data/ext/isomorfeus_ferret_ext/test_1710.c +11 -13
  87. data/ext/isomorfeus_ferret_ext/test_analysis.c +32 -64
  88. data/ext/isomorfeus_ferret_ext/test_array.c +6 -12
  89. data/ext/isomorfeus_ferret_ext/test_bitvector.c +12 -24
  90. data/ext/isomorfeus_ferret_ext/test_document.c +23 -33
  91. data/ext/isomorfeus_ferret_ext/test_except.c +10 -21
  92. data/ext/isomorfeus_ferret_ext/test_fields.c +62 -68
  93. data/ext/isomorfeus_ferret_ext/test_file_deleter.c +15 -23
  94. data/ext/isomorfeus_ferret_ext/test_filter.c +17 -27
  95. data/ext/isomorfeus_ferret_ext/test_global.c +14 -29
  96. data/ext/isomorfeus_ferret_ext/test_hash.c +19 -38
  97. data/ext/isomorfeus_ferret_ext/test_hashset.c +8 -16
  98. data/ext/isomorfeus_ferret_ext/test_helper.c +4 -8
  99. data/ext/isomorfeus_ferret_ext/test_highlighter.c +16 -28
  100. data/ext/isomorfeus_ferret_ext/test_index.c +277 -487
  101. data/ext/isomorfeus_ferret_ext/test_lang.c +7 -14
  102. data/ext/isomorfeus_ferret_ext/test_mdbx_store.c +2 -5
  103. data/ext/isomorfeus_ferret_ext/test_mempool.c +5 -10
  104. data/ext/isomorfeus_ferret_ext/test_multimapper.c +3 -6
  105. data/ext/isomorfeus_ferret_ext/test_priorityqueue.c +9 -18
  106. data/ext/isomorfeus_ferret_ext/test_q_const_score.c +4 -6
  107. data/ext/isomorfeus_ferret_ext/test_q_filtered.c +3 -4
  108. data/ext/isomorfeus_ferret_ext/test_q_fuzzy.c +9 -15
  109. data/ext/isomorfeus_ferret_ext/test_q_parser.c +8 -16
  110. data/ext/isomorfeus_ferret_ext/test_q_span.c +19 -35
  111. data/ext/isomorfeus_ferret_ext/test_ram_store.c +14 -13
  112. data/ext/isomorfeus_ferret_ext/test_search.c +60 -109
  113. data/ext/isomorfeus_ferret_ext/test_segments.c +8 -13
  114. data/ext/isomorfeus_ferret_ext/test_similarity.c +2 -4
  115. data/ext/isomorfeus_ferret_ext/test_sort.c +14 -24
  116. data/ext/isomorfeus_ferret_ext/test_store.c +96 -115
  117. data/ext/isomorfeus_ferret_ext/test_term.c +9 -15
  118. data/ext/isomorfeus_ferret_ext/test_term_vectors.c +9 -14
  119. data/ext/isomorfeus_ferret_ext/test_test.c +4 -8
  120. data/ext/isomorfeus_ferret_ext/test_threading.c +14 -20
  121. data/ext/isomorfeus_ferret_ext/testhelper.c +11 -21
  122. data/ext/isomorfeus_ferret_ext/testhelper.h +1 -1
  123. data/ext/isomorfeus_ferret_ext/tests_all.h +1 -2
  124. data/lib/isomorfeus/ferret/index/index.rb +1 -1
  125. data/lib/isomorfeus/ferret/version.rb +1 -1
  126. metadata +24 -4
@@ -7,8 +7,7 @@
7
7
 
8
8
  #define ARRAY_SIZE 100
9
9
 
10
- static void test_match_vector(TestCase *tc, void *data)
11
- {
10
+ static void test_match_vector(TestCase *tc, void *data) {
12
11
  const int match_test_count = 100;
13
12
  int i;
14
13
  FrtMatchVector *mv = frt_matchv_new();
@@ -79,21 +78,19 @@ static void test_match_vector(TestCase *tc, void *data)
79
78
  frt_matchv_destroy(mv);
80
79
  }
81
80
 
82
- static void make_index(FrtStore *store)
83
- {
81
+ static void make_index(FrtStore *store) {
84
82
  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 | FRT_FI_STORE_POSITIONS_BM | FRT_FI_STORE_OFFSETS_BM);
85
83
  frt_index_create(store, fis);
86
84
  frt_fis_deref(fis);
87
85
  }
88
86
 
89
- static void add_string_docs(FrtStore *store, const char *string[])
90
- {
87
+ static void add_string_docs(FrtStore *store, const char *string[]) {
91
88
  FrtIndexWriter *iw = frt_iw_open(NULL, store, frt_whitespace_analyzer_new(true), NULL);
92
89
  rb_encoding *enc = rb_enc_find("ASCII-8BIT");
93
90
 
94
91
  while (*string) {
95
92
  FrtDocument *doc = frt_doc_new();
96
- frt_doc_add_field(doc, frt_df_add_data(frt_df_new(rb_intern("field")), (char *)*string, enc));
93
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(rb_intern("field")), *string, enc));
97
94
  frt_iw_add_doc(iw, doc);
98
95
  frt_doc_destroy(doc);
99
96
  string++;
@@ -102,8 +99,7 @@ static void add_string_docs(FrtStore *store, const char *string[])
102
99
  }
103
100
 
104
101
  #define Chk_sea_mv(query, doc_num, expected) check_searcher_match_vector(tc, store, query, doc_num, expected)
105
- static void check_searcher_match_vector(TestCase *tc, FrtStore *store, FrtQuery *query, int doc_num, const char *expected)
106
- {
102
+ static void check_searcher_match_vector(TestCase *tc, FrtStore *store, FrtQuery *query, int doc_num, const char *expected) {
107
103
  FrtIndexReader *ir = frt_ir_open(NULL, store);
108
104
  FrtSearcher *sea = frt_isea_new(ir);
109
105
  FrtMatchVector *mv = frt_searcher_get_match_vector(sea, query, doc_num, rb_intern("field"));
@@ -123,8 +119,7 @@ static void check_searcher_match_vector(TestCase *tc, FrtStore *store, FrtQuery
123
119
  }
124
120
 
125
121
  #define Chk_mv(query, doc_num, expected) check_match_vector(tc, store, query, doc_num, expected)
126
- static void check_match_vector(TestCase *tc, FrtStore *store, FrtQuery *query, int doc_num, const char *expected)
127
- {
122
+ static void check_match_vector(TestCase *tc, FrtStore *store, FrtQuery *query, int doc_num, const char *expected) {
128
123
  FrtIndexReader *ir = frt_ir_open(NULL, store);
129
124
  FrtMatchVector *mv = frt_matchv_new();
130
125
  FrtTermVector *term_vector = ir->term_vector(ir, doc_num, rb_intern("field"));
@@ -145,8 +140,7 @@ static void check_match_vector(TestCase *tc, FrtStore *store, FrtQuery *query, i
145
140
  check_searcher_match_vector(tc, store, query, doc_num, expected);
146
141
  }
147
142
 
148
- static void test_term_query(TestCase *tc, void *data)
149
- {
143
+ static void test_term_query(TestCase *tc, void *data) {
150
144
  FrtStore *store = (FrtStore *)data;
151
145
  FrtQuery *q;
152
146
  const char *docs[] = {
@@ -168,8 +162,7 @@ static void test_term_query(TestCase *tc, void *data)
168
162
  frt_q_deref(q);
169
163
  }
170
164
 
171
- static void test_phrase_query(TestCase *tc, void *data)
172
- {
165
+ static void test_phrase_query(TestCase *tc, void *data) {
173
166
  FrtStore *store = (FrtStore *)data;
174
167
  FrtQuery *q;
175
168
  const char *docs[] = {
@@ -231,8 +224,7 @@ static void test_phrase_query(TestCase *tc, void *data)
231
224
  frt_q_deref(q);
232
225
  }
233
226
 
234
- static void test_boolean_query(TestCase *tc, void *data)
235
- {
227
+ static void test_boolean_query(TestCase *tc, void *data) {
236
228
  FrtStore *store = (FrtStore *)data;
237
229
  FrtQuery *q, *phq;
238
230
  const char *docs[] = {
@@ -255,8 +247,7 @@ static void test_boolean_query(TestCase *tc, void *data)
255
247
  frt_q_deref(q);
256
248
  }
257
249
 
258
- static void test_multi_term_query(TestCase *tc, void *data)
259
- {
250
+ static void test_multi_term_query(TestCase *tc, void *data) {
260
251
  FrtStore *store = (FrtStore *)data;
261
252
  FrtQuery *q;
262
253
  const char *docs[] = {
@@ -275,8 +266,7 @@ static void test_multi_term_query(TestCase *tc, void *data)
275
266
  frt_q_deref(q);
276
267
  }
277
268
 
278
- static void test_span_queries(TestCase *tc, void *data)
279
- {
269
+ static void test_span_queries(TestCase *tc, void *data) {
280
270
  FrtStore *store = (FrtStore *)data;
281
271
  FrtQuery *q, *oq;
282
272
  const char *docs[] = {
@@ -330,8 +320,7 @@ static void test_span_queries(TestCase *tc, void *data)
330
320
  frt_q_deref(q);
331
321
  }
332
322
 
333
- static void test_searcher_get_match_vector(TestCase *tc, void *data)
334
- {
323
+ static void test_searcher_get_match_vector(TestCase *tc, void *data) {
335
324
  FrtStore *store = (FrtStore *)data;
336
325
  FrtQuery *q;
337
326
  const char *docs[] = {
@@ -353,8 +342,7 @@ static void test_searcher_get_match_vector(TestCase *tc, void *data)
353
342
  frt_q_deref(q);
354
343
  }
355
344
 
356
- static void test_searcher_highlight(TestCase *tc, void *data)
357
- {
345
+ static void test_searcher_highlight(TestCase *tc, void *data) {
358
346
  FrtStore *store = (FrtStore *)data;
359
347
  FrtQuery *q, *phq;
360
348
  FrtIndexWriter *iw;
@@ -374,7 +362,7 @@ static void test_searcher_highlight(TestCase *tc, void *data)
374
362
  add_string_docs(store, docs);
375
363
 
376
364
  iw = frt_iw_open(NULL, store, frt_letter_analyzer_new(true), NULL);
377
- frt_doc_add_field(doc, frt_df_add_data(frt_df_new(rb_intern("field")), (char *)"That's how it goes now.", enc));
365
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(rb_intern("field")), "That's how it goes now.", enc));
378
366
  frt_iw_add_doc(iw, doc);
379
367
  frt_doc_destroy(doc);
380
368
  frt_iw_close(iw);
@@ -532,9 +520,9 @@ static void test_searcher_highlight(TestCase *tc, void *data)
532
520
  frt_ir_close(ir);
533
521
  }
534
522
 
535
- TestSuite *ts_highlighter(TestSuite *suite)
536
- {
523
+ TestSuite *ts_highlighter(TestSuite *suite) {
537
524
  FrtStore *store = frt_open_ram_store(NULL);
525
+ store->create_folder(store, segm_idx_name);
538
526
 
539
527
  suite = ADD_SUITE(suite);
540
528