isomorfeus-ferret 0.12.7 → 0.13.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +101 -19
  3. data/README.md +85 -13
  4. data/ext/isomorfeus_ferret_ext/bm_bitvector.c +22 -30
  5. data/ext/isomorfeus_ferret_ext/bm_hash.c +6 -12
  6. data/ext/isomorfeus_ferret_ext/bm_micro_string.c +3 -6
  7. data/ext/isomorfeus_ferret_ext/bm_store.c +11 -22
  8. data/ext/isomorfeus_ferret_ext/brotli_common_dictionary.c +1 -1
  9. data/ext/isomorfeus_ferret_ext/brotli_dec_decode.c +1 -1
  10. data/ext/isomorfeus_ferret_ext/bzlib.c +1572 -0
  11. data/ext/isomorfeus_ferret_ext/bzlib.h +282 -0
  12. data/ext/isomorfeus_ferret_ext/bzlib_blocksort.c +1094 -0
  13. data/ext/isomorfeus_ferret_ext/bzlib_compress.c +672 -0
  14. data/ext/isomorfeus_ferret_ext/bzlib_crctable.c +104 -0
  15. data/ext/isomorfeus_ferret_ext/bzlib_decompress.c +652 -0
  16. data/ext/isomorfeus_ferret_ext/bzlib_huffman.c +205 -0
  17. data/ext/isomorfeus_ferret_ext/bzlib_private.h +509 -0
  18. data/ext/isomorfeus_ferret_ext/bzlib_randtable.c +84 -0
  19. data/ext/isomorfeus_ferret_ext/fio_tmpfile.h +53 -53
  20. data/ext/isomorfeus_ferret_ext/frb_analysis.c +785 -1192
  21. data/ext/isomorfeus_ferret_ext/frb_index.c +497 -495
  22. data/ext/isomorfeus_ferret_ext/frb_qparser.c +48 -60
  23. data/ext/isomorfeus_ferret_ext/frb_search.c +1520 -1002
  24. data/ext/isomorfeus_ferret_ext/frb_store.c +96 -96
  25. data/ext/isomorfeus_ferret_ext/frb_threading.h +0 -1
  26. data/ext/isomorfeus_ferret_ext/frb_utils.c +147 -196
  27. data/ext/isomorfeus_ferret_ext/frt_analysis.c +695 -1090
  28. data/ext/isomorfeus_ferret_ext/frt_analysis.h +174 -170
  29. data/ext/isomorfeus_ferret_ext/frt_array.c +2 -4
  30. data/ext/isomorfeus_ferret_ext/frt_bitvector.c +9 -16
  31. data/ext/isomorfeus_ferret_ext/frt_bitvector.h +32 -81
  32. data/ext/isomorfeus_ferret_ext/frt_document.c +15 -20
  33. data/ext/isomorfeus_ferret_ext/frt_document.h +10 -10
  34. data/ext/isomorfeus_ferret_ext/frt_except.c +5 -12
  35. data/ext/isomorfeus_ferret_ext/frt_field_index.c +3 -3
  36. data/ext/isomorfeus_ferret_ext/frt_field_index.h +6 -7
  37. data/ext/isomorfeus_ferret_ext/frt_filter.c +35 -46
  38. data/ext/isomorfeus_ferret_ext/frt_fs_store.c +1 -0
  39. data/ext/isomorfeus_ferret_ext/frt_global.c +91 -200
  40. data/ext/isomorfeus_ferret_ext/frt_global.h +7 -18
  41. data/ext/isomorfeus_ferret_ext/frt_hash.c +1 -2
  42. data/ext/isomorfeus_ferret_ext/frt_ind.c +32 -35
  43. data/ext/isomorfeus_ferret_ext/frt_ind.h +9 -9
  44. data/ext/isomorfeus_ferret_ext/frt_index.c +603 -410
  45. data/ext/isomorfeus_ferret_ext/frt_index.h +272 -291
  46. data/ext/isomorfeus_ferret_ext/frt_lang.c +0 -2
  47. data/ext/isomorfeus_ferret_ext/frt_mempool.c +1 -2
  48. data/ext/isomorfeus_ferret_ext/frt_multimapper.c +4 -7
  49. data/ext/isomorfeus_ferret_ext/frt_q_boolean.c +68 -91
  50. data/ext/isomorfeus_ferret_ext/frt_q_const_score.c +35 -38
  51. data/ext/isomorfeus_ferret_ext/frt_q_filtered_query.c +53 -72
  52. data/ext/isomorfeus_ferret_ext/frt_q_fuzzy.c +25 -32
  53. data/ext/isomorfeus_ferret_ext/frt_q_match_all.c +21 -23
  54. data/ext/isomorfeus_ferret_ext/frt_q_multi_term.c +66 -103
  55. data/ext/isomorfeus_ferret_ext/frt_q_parser.c +207 -195
  56. data/ext/isomorfeus_ferret_ext/frt_q_phrase.c +20 -16
  57. data/ext/isomorfeus_ferret_ext/frt_q_prefix.c +17 -14
  58. data/ext/isomorfeus_ferret_ext/frt_q_range.c +102 -131
  59. data/ext/isomorfeus_ferret_ext/frt_q_span.c +179 -178
  60. data/ext/isomorfeus_ferret_ext/frt_q_term.c +47 -60
  61. data/ext/isomorfeus_ferret_ext/frt_q_wildcard.c +18 -16
  62. data/ext/isomorfeus_ferret_ext/frt_ram_store.c +45 -84
  63. data/ext/isomorfeus_ferret_ext/frt_search.c +105 -146
  64. data/ext/isomorfeus_ferret_ext/frt_search.h +331 -320
  65. data/ext/isomorfeus_ferret_ext/frt_similarity.c +5 -13
  66. data/ext/isomorfeus_ferret_ext/frt_similarity.h +7 -12
  67. data/ext/isomorfeus_ferret_ext/frt_sort.c +105 -149
  68. data/ext/isomorfeus_ferret_ext/frt_store.c +13 -7
  69. data/ext/isomorfeus_ferret_ext/frt_store.h +10 -2
  70. data/ext/isomorfeus_ferret_ext/frt_threading.h +0 -1
  71. data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.c +22 -112
  72. data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.h +2 -32
  73. data/ext/isomorfeus_ferret_ext/lz4.c +2495 -0
  74. data/ext/isomorfeus_ferret_ext/lz4.h +774 -0
  75. data/ext/isomorfeus_ferret_ext/lz4frame.c +1899 -0
  76. data/ext/isomorfeus_ferret_ext/lz4frame.h +623 -0
  77. data/ext/isomorfeus_ferret_ext/lz4hc.c +1615 -0
  78. data/ext/isomorfeus_ferret_ext/lz4hc.h +413 -0
  79. data/ext/isomorfeus_ferret_ext/lz4xxhash.c +1030 -0
  80. data/ext/isomorfeus_ferret_ext/lz4xxhash.h +328 -0
  81. data/ext/isomorfeus_ferret_ext/stem_modules.h +0 -86
  82. data/ext/isomorfeus_ferret_ext/test.c +0 -17
  83. data/ext/isomorfeus_ferret_ext/test_1710.c +11 -12
  84. data/ext/isomorfeus_ferret_ext/test_analysis.c +590 -583
  85. data/ext/isomorfeus_ferret_ext/test_compound_io.c +1 -1
  86. data/ext/isomorfeus_ferret_ext/test_document.c +19 -15
  87. data/ext/isomorfeus_ferret_ext/test_except.c +1 -2
  88. data/ext/isomorfeus_ferret_ext/test_fields.c +59 -60
  89. data/ext/isomorfeus_ferret_ext/test_file_deleter.c +10 -27
  90. data/ext/isomorfeus_ferret_ext/test_filter.c +11 -8
  91. data/ext/isomorfeus_ferret_ext/test_global.c +0 -46
  92. data/ext/isomorfeus_ferret_ext/test_hash.c +2 -2
  93. data/ext/isomorfeus_ferret_ext/test_hashset.c +1 -1
  94. data/ext/isomorfeus_ferret_ext/test_highlighter.c +15 -11
  95. data/ext/isomorfeus_ferret_ext/test_index.c +372 -365
  96. data/ext/isomorfeus_ferret_ext/test_q_const_score.c +5 -3
  97. data/ext/isomorfeus_ferret_ext/test_q_filtered.c +5 -3
  98. data/ext/isomorfeus_ferret_ext/test_q_fuzzy.c +13 -10
  99. data/ext/isomorfeus_ferret_ext/test_q_parser.c +45 -7
  100. data/ext/isomorfeus_ferret_ext/test_q_span.c +15 -12
  101. data/ext/isomorfeus_ferret_ext/test_ram_store.c +3 -3
  102. data/ext/isomorfeus_ferret_ext/test_search.c +60 -64
  103. data/ext/isomorfeus_ferret_ext/test_segments.c +5 -4
  104. data/ext/isomorfeus_ferret_ext/test_sort.c +17 -14
  105. data/ext/isomorfeus_ferret_ext/test_store.c +2 -0
  106. data/ext/isomorfeus_ferret_ext/test_term.c +3 -1
  107. data/ext/isomorfeus_ferret_ext/test_term_vectors.c +9 -10
  108. data/ext/isomorfeus_ferret_ext/test_test.c +1 -2
  109. data/ext/isomorfeus_ferret_ext/test_threading.c +9 -10
  110. data/ext/isomorfeus_ferret_ext/testhelper.c +1 -2
  111. data/lib/isomorfeus/ferret/version.rb +1 -1
  112. metadata +27 -57
  113. data/ext/isomorfeus_ferret_ext/email.rl +0 -21
  114. data/ext/isomorfeus_ferret_ext/frt_scanner.c +0 -900
  115. data/ext/isomorfeus_ferret_ext/frt_scanner.h +0 -28
  116. data/ext/isomorfeus_ferret_ext/frt_scanner_mb.c +0 -6706
  117. data/ext/isomorfeus_ferret_ext/frt_scanner_utf8.c +0 -4420
  118. data/ext/isomorfeus_ferret_ext/scanner.h +0 -28
  119. data/ext/isomorfeus_ferret_ext/scanner.in +0 -43
  120. data/ext/isomorfeus_ferret_ext/scanner.rl +0 -84
  121. data/ext/isomorfeus_ferret_ext/scanner_mb.rl +0 -200
  122. data/ext/isomorfeus_ferret_ext/scanner_utf8.rl +0 -85
  123. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_basque.c +0 -1167
  124. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_basque.h +0 -6
  125. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_catalan.c +0 -1433
  126. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_catalan.h +0 -6
  127. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_danish.c +0 -301
  128. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_danish.h +0 -6
  129. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_dutch.c +0 -590
  130. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_dutch.h +0 -6
  131. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_english.c +0 -1049
  132. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_english.h +0 -6
  133. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_finnish.c +0 -705
  134. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_finnish.h +0 -6
  135. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_french.c +0 -1239
  136. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_french.h +0 -6
  137. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_german.c +0 -477
  138. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_german.h +0 -6
  139. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_hungarian.c +0 -1217
  140. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_hungarian.h +0 -7
  141. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_indonesian.c +0 -394
  142. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_indonesian.h +0 -6
  143. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_irish.c +0 -457
  144. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_irish.h +0 -6
  145. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_italian.c +0 -1009
  146. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_italian.h +0 -6
  147. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_norwegian.c +0 -259
  148. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_norwegian.h +0 -6
  149. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_porter.c +0 -704
  150. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_porter.h +0 -6
  151. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_portuguese.c +0 -948
  152. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_portuguese.h +0 -6
  153. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_spanish.c +0 -1028
  154. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_spanish.h +0 -6
  155. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_swedish.c +0 -275
  156. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_swedish.h +0 -6
  157. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_hungarian.c +0 -849
  158. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_hungarian.h +0 -6
  159. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_romanian.c +0 -952
  160. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_romanian.h +0 -6
  161. data/ext/isomorfeus_ferret_ext/stem_KOI8_R_russian.c +0 -669
  162. data/ext/isomorfeus_ferret_ext/stem_KOI8_R_russian.h +0 -6
  163. data/ext/isomorfeus_ferret_ext/stem_modules.txt +0 -63
  164. data/ext/isomorfeus_ferret_ext/uchar-ucs4.rl +0 -1854
  165. data/ext/isomorfeus_ferret_ext/uchar-utf8.rl +0 -1999
  166. data/ext/isomorfeus_ferret_ext/url.rl +0 -27
@@ -5,9 +5,11 @@
5
5
  #include "testhelper.h"
6
6
  #include "test.h"
7
7
 
8
+ #undef close
9
+
8
10
  #define ARRAY_SIZE 40
9
11
 
10
- static FrtSymbol date, field, cat, number;
12
+ static ID date, field, cat, number;
11
13
 
12
14
  static void test_byte_float_conversion(TestCase *tc, void *data)
13
15
  {
@@ -19,9 +21,7 @@ static void test_byte_float_conversion(TestCase *tc, void *data)
19
21
  }
20
22
  }
21
23
 
22
- static int my_doc_freq(FrtSearcher *searcher, FrtSymbol field,
23
- const char *term)
24
- {
24
+ static int my_doc_freq(FrtSearcher *searcher, ID field, const char *term) {
25
25
  (void)searcher; (void)field; (void)term;
26
26
  return 9;
27
27
  }
@@ -137,14 +137,13 @@ static FrtTokenStream *dbl_tf_clone_i(FrtTokenStream *ts)
137
137
 
138
138
  static FrtTokenStream *dbl_tf_new(FrtTokenStream *sub_ts)
139
139
  {
140
- FrtTokenStream *ts = tf_new(DoubleFilter, sub_ts);
141
- ts->next = &dbl_tf_next;
142
- ts->clone_i = &dbl_tf_clone_i;
140
+ FrtTokenStream *ts = frt_tf_new_i(sizeof(DoubleFilter), sub_ts);
141
+ ts->next = &dbl_tf_next;
142
+ ts->clone_i = &dbl_tf_clone_i;
143
143
  return ts;
144
144
  }
145
145
 
146
- FrtAnalyzer *dbl_analyzer_new()
147
- {
146
+ FrtAnalyzer *dbl_analyzer_new(void) {
148
147
  FrtTokenStream *ts;
149
148
  ts = dbl_tf_new(frt_whitespace_tokenizer_new());
150
149
  return frt_analyzer_new(ts, NULL, NULL);
@@ -206,20 +205,21 @@ static void prepare_search_index(FrtStore *store)
206
205
  int i;
207
206
  FrtIndexWriter *iw;
208
207
 
209
- FrtFieldInfos *fis = frt_fis_new(FRT_STORE_YES, FRT_INDEX_YES, FRT_TERM_VECTOR_WITH_POSITIONS_OFFSETS);
210
- FrtFieldInfo *fi = frt_fi_new(rb_intern("empty-field"), FRT_STORE_NO, FRT_INDEX_NO, FRT_TERM_VECTOR_NO);
208
+ FrtFieldInfos *fis = frt_fis_new(FRT_STORE_YES, FRT_COMPRESSION_NONE, FRT_INDEX_YES, FRT_TERM_VECTOR_WITH_POSITIONS_OFFSETS);
209
+ FrtFieldInfo *fi = frt_fi_new(rb_intern("empty-field"), FRT_STORE_NO, FRT_COMPRESSION_NONE, FRT_INDEX_NO, FRT_TERM_VECTOR_NO);
211
210
  frt_fis_add_field(fis, fi);
212
211
  frt_index_create(store, fis);
213
212
  frt_fis_deref(fis);
213
+ rb_encoding *enc = rb_enc_find("ASCII-8BIT");
214
214
 
215
- iw = frt_iw_open(store, dbl_analyzer_new(), NULL);
215
+ iw = frt_iw_open(NULL, store, dbl_analyzer_new(), NULL);
216
216
  for (i = 0; i < SEARCH_DOCS_SIZE; i++) {
217
217
  FrtDocument *doc = frt_doc_new();
218
218
  doc->boost = (float)(i+1);
219
- frt_doc_add_field(doc, frt_df_add_data(frt_df_new(date), (char *)test_data[i].date));
220
- frt_doc_add_field(doc, frt_df_add_data(frt_df_new(field), (char *)test_data[i].field));
221
- frt_doc_add_field(doc, frt_df_add_data(frt_df_new(cat), (char *)test_data[i].cat));
222
- frt_doc_add_field(doc, frt_df_add_data(frt_df_new(number), (char *)test_data[i].number));
219
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(date), (char *)test_data[i].date, enc));
220
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(field), (char *)test_data[i].field, enc));
221
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(cat), (char *)test_data[i].cat, enc));
222
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(number), (char *)test_data[i].number, enc));
223
223
  frt_iw_add_doc(iw, doc);
224
224
  frt_doc_destroy(doc);
225
225
  }
@@ -252,7 +252,7 @@ static void test_get_doc(TestCase *tc, void *data)
252
252
  frt_doc_destroy(doc);
253
253
  }
254
254
 
255
- void check_to_s(TestCase *tc, FrtQuery *query, FrtSymbol field, const char *q_str)
255
+ void check_to_s(TestCase *tc, FrtQuery *query, ID field, const char *q_str)
256
256
  {
257
257
  char *q_res = query->to_s(query, field);
258
258
  Asequal(q_str, q_res);
@@ -266,7 +266,6 @@ void tst_check_hits(TestCase *tc, FrtSearcher *searcher, FrtQuery *query, const
266
266
  int i, count;
267
267
  int total_hits = s2l(expected_hits, num_array);
268
268
  FrtTopDocs *top_docs = frt_searcher_search(searcher, query, 0, total_hits + 1, NULL, NULL, NULL);
269
- frt_p_pause();
270
269
  if (!tc->failed && !Aiequal(total_hits, top_docs->total_hits)) {
271
270
  int i;
272
271
  Tmsg_nf("\texpected docs:\n\t ");
@@ -314,11 +313,10 @@ void tst_check_hits(TestCase *tc, FrtSearcher *searcher, FrtQuery *query, const
314
313
  count = frt_searcher_search_unscored(searcher, query, num_array2, ARRAY_SIZE, num_array2[3]);
315
314
  Aaiequal(num_array + 3, num_array2, count);
316
315
  }
317
- frt_p_resume();
318
316
  }
319
317
 
320
318
  void check_match_vector(TestCase *tc, FrtSearcher *searcher, FrtQuery *query,
321
- int doc, FrtSymbol field, const char *ranges)
319
+ int doc, ID field, const char *ranges)
322
320
  {
323
321
  static int range_array[ARRAY_SIZE];
324
322
  FrtMatchVector *mv = frt_searcher_get_match_vector(searcher, query, doc, field);
@@ -342,11 +340,11 @@ static void test_term_query(TestCase *tc, void *data)
342
340
  char *t, e[100];
343
341
  FrtQuery *tq = frt_tq_new(field, "word2");
344
342
  check_to_s(tc, tq, field, "word2");
345
- check_to_s(tc, tq, (FrtSymbol)NULL, "field:word2");
343
+ check_to_s(tc, tq, (ID)NULL, "field:word2");
346
344
  tq->boost = 100;
347
345
  tst_check_hits(tc, searcher, tq, "4, 8, 1", -1);
348
346
  check_to_s(tc, tq, field, "word2^100.0");
349
- check_to_s(tc, tq, (FrtSymbol)NULL, "field:word2^100.0");
347
+ check_to_s(tc, tq, (ID)NULL, "field:word2^100.0");
350
348
 
351
349
  /* test TermWeight.to_s */
352
350
  w = searcher->create_weight(searcher, tq);
@@ -554,13 +552,13 @@ static void test_phrase_query(TestCase *tc, void *data)
554
552
  FrtWeight *w;
555
553
  char *t, e[100];
556
554
  check_to_s(tc, phq, field, "\"\"");
557
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"\"");
555
+ check_to_s(tc, phq, (ID)NULL, "field:\"\"");
558
556
 
559
557
  frt_phq_add_term(phq, "quick", 1);
560
558
  frt_phq_add_term(phq, "brown", 1);
561
559
  frt_phq_add_term(phq, "fox", 1);
562
560
  check_to_s(tc, phq, field, "\"quick brown fox\"");
563
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"quick brown fox\"");
561
+ check_to_s(tc, phq, (ID)NULL, "field:\"quick brown fox\"");
564
562
  tst_check_hits(tc, searcher, phq, "1", 1);
565
563
 
566
564
  frt_phq_set_slop(phq, 4);
@@ -581,7 +579,7 @@ static void test_phrase_query(TestCase *tc, void *data)
581
579
  frt_phq_add_term(phq, "quick", 1);
582
580
  frt_phq_add_term(phq, "fox", 2);
583
581
  check_to_s(tc, phq, field, "\"quick <> fox\"");
584
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"quick <> fox\"");
582
+ check_to_s(tc, phq, (ID)NULL, "field:\"quick <> fox\"");
585
583
  tst_check_hits(tc, searcher, phq, "1, 11, 14", 14);
586
584
 
587
585
  frt_phq_set_slop(phq, 1);
@@ -590,19 +588,19 @@ static void test_phrase_query(TestCase *tc, void *data)
590
588
  frt_phq_set_slop(phq, 4);
591
589
  tst_check_hits(tc, searcher, phq, "1, 11, 14, 16, 17", 14);
592
590
  frt_phq_add_term(phq, "red", -1);
593
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"quick red fox\"~4");
591
+ check_to_s(tc, phq, (ID)NULL, "field:\"quick red fox\"~4");
594
592
  tst_check_hits(tc, searcher, phq, "11", 11);
595
593
  frt_phq_add_term(phq, "RED", 0);
596
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"quick red RED&fox\"~4");
594
+ check_to_s(tc, phq, (ID)NULL, "field:\"quick red RED&fox\"~4");
597
595
  tst_check_hits(tc, searcher, phq, "11", 11);
598
596
  frt_phq_add_term(phq, "QUICK", -1);
599
597
  frt_phq_add_term(phq, "red", 0);
600
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"quick QUICK&red&red RED&fox\"~4");
598
+ check_to_s(tc, phq, (ID)NULL, "field:\"quick QUICK&red&red RED&fox\"~4");
601
599
  tst_check_hits(tc, searcher, phq, "11", 11);
602
600
  frt_phq_add_term(phq, "green", 0);
603
601
  frt_phq_add_term(phq, "yellow", 0);
604
602
  frt_phq_add_term(phq, "sentinel", 1);
605
- check_to_s(tc, phq, (FrtSymbol)NULL,
603
+ check_to_s(tc, phq, (ID)NULL,
606
604
  "field:\"quick QUICK&red&red RED&fox&green&yellow sentinel\"~4");
607
605
  tst_check_hits(tc, searcher, phq, "", -1);
608
606
  frt_q_deref(phq);
@@ -615,7 +613,7 @@ static void test_phrase_query(TestCase *tc, void *data)
615
613
  frt_phq_add_term(phq, "quick", 0);
616
614
  frt_phq_add_term(phq, "QUICK", 1);
617
615
  tst_check_hits(tc, searcher, phq, "11, 14", 14);
618
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"WORD3&the THE&quick QUICK\"");
616
+ check_to_s(tc, phq, (ID)NULL, "field:\"WORD3&the THE&quick QUICK\"");
619
617
  frt_q_deref(phq);
620
618
 
621
619
  /* test repeating terms check */
@@ -740,30 +738,30 @@ static void test_multi_phrase_query(TestCase *tc, void *data)
740
738
  frt_phq_append_multi_term(phq, "fast");
741
739
  tst_check_hits(tc, searcher, phq, "1, 8, 11, 14, 16, 17", -1);
742
740
  check_to_s(tc, phq, field, "\"quick|fast\"");
743
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"quick|fast\"");
741
+ check_to_s(tc, phq, (ID)NULL, "field:\"quick|fast\"");
744
742
 
745
743
  frt_phq_add_term(phq, "brown", 1);
746
744
  frt_phq_append_multi_term(phq, "red");
747
745
  frt_phq_append_multi_term(phq, "hairy");
748
746
  frt_phq_add_term(phq, "fox", 1);
749
747
  check_to_s(tc, phq, field, "\"quick|fast brown|red|hairy fox\"");
750
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"quick|fast brown|red|hairy fox\"");
748
+ check_to_s(tc, phq, (ID)NULL, "field:\"quick|fast brown|red|hairy fox\"");
751
749
  tst_check_hits(tc, searcher, phq, "1, 8, 11, 14", -1);
752
750
 
753
751
  frt_phq_set_slop(phq, 4);
754
752
  tst_check_hits(tc, searcher, phq, "1, 8, 11, 14, 16, 17", -1);
755
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"quick|fast brown|red|hairy fox\"~4");
753
+ check_to_s(tc, phq, (ID)NULL, "field:\"quick|fast brown|red|hairy fox\"~4");
756
754
 
757
755
  frt_phq_add_term(phq, "QUICK", -1);
758
756
  frt_phq_append_multi_term(phq, "FAST");
759
757
  tst_check_hits(tc, searcher, phq, "1, 8, 11, 14, 16, 17", -1);
760
- check_to_s(tc, phq, (FrtSymbol)NULL,
758
+ check_to_s(tc, phq, (ID)NULL,
761
759
  "field:\"quick|fast QUICK|FAST&brown|red|hairy fox\"~4");
762
760
 
763
761
  frt_phq_add_term(phq, "WORD3", -3);
764
762
  frt_phq_append_multi_term(phq, "WORD2");
765
763
  tst_check_hits(tc, searcher, phq, "1, 8, 11, 14", -1);
766
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"WORD3|WORD2 quick|fast "
764
+ check_to_s(tc, phq, (ID)NULL, "field:\"WORD3|WORD2 quick|fast "
767
765
  "QUICK|FAST&brown|red|hairy fox\"~4");
768
766
 
769
767
  frt_q_deref(phq);
@@ -776,11 +774,11 @@ static void test_multi_phrase_query(TestCase *tc, void *data)
776
774
  frt_phq_add_term(phq, "two", 1);
777
775
  frt_phq_add_term(phq, "one", 1);
778
776
  tst_check_hits(tc, searcher, phq, "2", -1);
779
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"WORD3|x&one two one\"");
777
+ check_to_s(tc, phq, (ID)NULL, "field:\"WORD3|x&one two one\"");
780
778
 
781
779
  frt_phq_set_slop(phq, 4);
782
780
  tst_check_hits(tc, searcher, phq, "2", -1);
783
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"WORD3|x&one two one\"~4");
781
+ check_to_s(tc, phq, (ID)NULL, "field:\"WORD3|x&one two one\"~4");
784
782
  frt_q_deref(phq);
785
783
 
786
784
  /* test phrase query on non-existing field doesn't break anything */
@@ -900,40 +898,40 @@ static void test_multi_term_query(TestCase *tc, void *data)
900
898
  mtq = frt_multi_tq_new_conf(field, 4, 0.5);
901
899
  tst_check_hits(tc, searcher, mtq, "", -1);
902
900
  check_to_s(tc, mtq, field, "\"\"");
903
- check_to_s(tc, mtq, (FrtSymbol)NULL, "field:\"\"");
901
+ check_to_s(tc, mtq, (ID)NULL, "field:\"\"");
904
902
 
905
903
  frt_multi_tq_add_term(mtq, "brown");
906
904
  tst_check_hits(tc, searcher, mtq, "1, 8, 16, 17", -1);
907
905
  check_to_s(tc, mtq, field, "\"brown\"");
908
- check_to_s(tc, mtq, (FrtSymbol)NULL, "field:\"brown\"");
906
+ check_to_s(tc, mtq, (ID)NULL, "field:\"brown\"");
909
907
 
910
908
 
911
909
  /* 0.4f boost is below the 0.5 threshold so term is ignored */
912
910
  frt_multi_tq_add_term_boost(mtq, "fox", 0.4f);
913
911
  tst_check_hits(tc, searcher, mtq, "1, 8, 16, 17", -1);
914
912
  check_to_s(tc, mtq, field, "\"brown\"");
915
- check_to_s(tc, mtq, (FrtSymbol)NULL, "field:\"brown\"");
913
+ check_to_s(tc, mtq, (ID)NULL, "field:\"brown\"");
916
914
 
917
915
  /* 0.6f boost is above the 0.5 threshold so term is included */
918
916
  frt_multi_tq_add_term_boost(mtq, "fox", 0.6f);
919
917
  tst_check_hits(tc, searcher, mtq, "1, 8, 11, 14, 16, 17", -1);
920
918
  check_to_s(tc, mtq, field, "\"fox^0.6|brown\"");
921
- check_to_s(tc, mtq, (FrtSymbol)NULL, "field:\"fox^0.6|brown\"");
919
+ check_to_s(tc, mtq, (ID)NULL, "field:\"fox^0.6|brown\"");
922
920
 
923
921
  frt_multi_tq_add_term_boost(mtq, "fast", 50.0f);
924
922
  tst_check_hits(tc, searcher, mtq, "1, 8, 11, 14, 16, 17", 8);
925
923
  check_to_s(tc, mtq, field, "\"fox^0.6|brown|fast^50.0\"");
926
- check_to_s(tc, mtq, (FrtSymbol)NULL, "field:\"fox^0.6|brown|fast^50.0\"");
924
+ check_to_s(tc, mtq, (ID)NULL, "field:\"fox^0.6|brown|fast^50.0\"");
927
925
 
928
926
 
929
927
  mtq->boost = 80.1f;
930
- check_to_s(tc, mtq, (FrtSymbol)NULL, "field:\"fox^0.6|brown|fast^50.0\"^80.1");
928
+ check_to_s(tc, mtq, (ID)NULL, "field:\"fox^0.6|brown|fast^50.0\"^80.1");
931
929
  frt_multi_tq_add_term(mtq, "word1");
932
- check_to_s(tc, mtq, (FrtSymbol)NULL, "field:\"fox^0.6|brown|word1|fast^50.0\"^80.1");
930
+ check_to_s(tc, mtq, (ID)NULL, "field:\"fox^0.6|brown|word1|fast^50.0\"^80.1");
933
931
  frt_multi_tq_add_term(mtq, "word2");
934
- check_to_s(tc, mtq, (FrtSymbol)NULL, "field:\"brown|word1|word2|fast^50.0\"^80.1");
932
+ check_to_s(tc, mtq, (ID)NULL, "field:\"brown|word1|word2|fast^50.0\"^80.1");
935
933
  frt_multi_tq_add_term(mtq, "word3");
936
- check_to_s(tc, mtq, (FrtSymbol)NULL, "field:\"brown|word1|word2|fast^50.0\"^80.1");
934
+ check_to_s(tc, mtq, (ID)NULL, "field:\"brown|word1|word2|fast^50.0\"^80.1");
937
935
 
938
936
  /* test MultiTermWeight.to_s */
939
937
  w = searcher->create_weight(searcher, mtq);
@@ -956,7 +954,7 @@ static void test_multi_term_query(TestCase *tc, void *data)
956
954
  frt_bq_add_query(bq, mtq, FRT_BC_MUST);
957
955
  tst_check_hits(tc, searcher, bq, "1, 11, 14, 16, 17", -1);
958
956
  check_to_s(tc, bq, field, "+quick +\"fox^0.6|brown|word1\"");
959
- check_to_s(tc, bq, (FrtSymbol)NULL, "+field:quick +field:\"fox^0.6|brown|word1\"");
957
+ check_to_s(tc, bq, (ID)NULL, "+field:quick +field:\"fox^0.6|brown|word1\"");
960
958
  frt_q_deref(bq);
961
959
  frt_q_deref(mtq);
962
960
 
@@ -978,7 +976,7 @@ static void test_multi_term_query_hash(TestCase *tc, void *data)
978
976
  (void)data;
979
977
 
980
978
 
981
- check_to_s(tc, q1, (FrtSymbol)NULL, "field:\"\"");
979
+ check_to_s(tc, q1, (ID)NULL, "field:\"\"");
982
980
  Assert(frt_q_hash(q1) == frt_q_hash(q2), "Queries should be equal");
983
981
  Assert(frt_q_eq(q1, q1), "Same queries should be equal");
984
982
  Assert(frt_q_eq(q1, q2), "Queries should be equal");
@@ -1637,7 +1635,7 @@ static void test_search_unscored(TestCase *tc, void *data)
1637
1635
 
1638
1636
  TestSuite *ts_search(TestSuite *suite)
1639
1637
  {
1640
- FrtStore *store = frt_open_ram_store();
1638
+ FrtStore *store = frt_open_ram_store(NULL);
1641
1639
  FrtIndexReader *ir;
1642
1640
  FrtSearcher *searcher;
1643
1641
 
@@ -1653,7 +1651,7 @@ TestSuite *ts_search(TestSuite *suite)
1653
1651
  tst_run_test(suite, test_default_similarity, NULL);
1654
1652
 
1655
1653
  prepare_search_index(store);
1656
- ir = frt_ir_open(store);
1654
+ ir = frt_ir_open(NULL, store);
1657
1655
  searcher = frt_isea_new(ir);
1658
1656
 
1659
1657
  tst_run_test(suite, test_get_doc, (void *)searcher);
@@ -1702,22 +1700,21 @@ static void prepare_multi_search_index(FrtStore *store, struct Data data[],
1702
1700
  {
1703
1701
  int i;
1704
1702
  FrtIndexWriter *iw;
1705
- FrtFieldInfos *fis = frt_fis_new(FRT_STORE_YES,
1706
- FRT_INDEX_YES,
1707
- FRT_TERM_VECTOR_WITH_POSITIONS_OFFSETS);
1708
- FrtFieldInfo *fi = frt_fi_new(rb_intern("empty-field"), FRT_STORE_NO, FRT_INDEX_NO, FRT_TERM_VECTOR_NO);
1703
+ FrtFieldInfos *fis = frt_fis_new(FRT_STORE_YES, FRT_COMPRESSION_NONE, FRT_INDEX_YES, FRT_TERM_VECTOR_WITH_POSITIONS_OFFSETS);
1704
+ FrtFieldInfo *fi = frt_fi_new(rb_intern("empty-field"), FRT_STORE_NO, FRT_COMPRESSION_NONE, FRT_INDEX_NO, FRT_TERM_VECTOR_NO);
1709
1705
  frt_fis_add_field(fis, fi);
1710
1706
  frt_index_create(store, fis);
1711
1707
  frt_fis_deref(fis);
1708
+ rb_encoding *enc = rb_enc_find("ASCII-8BIT");
1712
1709
 
1713
- iw = frt_iw_open(store, dbl_analyzer_new(), NULL);
1710
+ iw = frt_iw_open(NULL, store, dbl_analyzer_new(), NULL);
1714
1711
  for (i = 0; i < d_cnt; i++) {
1715
1712
  FrtDocument *doc = frt_doc_new();
1716
1713
  doc->boost = (float)(i+w);
1717
- frt_doc_add_field(doc, frt_df_add_data(frt_df_new(date), (char *)data[i].date));
1718
- frt_doc_add_field(doc, frt_df_add_data(frt_df_new(field), (char *)data[i].field));
1719
- frt_doc_add_field(doc, frt_df_add_data(frt_df_new(cat), (char *)data[i].cat));
1720
- frt_doc_add_field(doc, frt_df_add_data(frt_df_new(number), (char *)data[i].number));
1714
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(date), (char *)data[i].date, enc));
1715
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(field), (char *)data[i].field, enc));
1716
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(cat), (char *)data[i].cat, enc));
1717
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(number), (char *)data[i].number, enc));
1721
1718
  frt_iw_add_doc(iw, doc);
1722
1719
  frt_doc_destroy(doc);
1723
1720
  }
@@ -1826,8 +1823,8 @@ static void test_query_combine(TestCase *tc, void *data)
1826
1823
 
1827
1824
  TestSuite *ts_multi_search(TestSuite *suite)
1828
1825
  {
1829
- FrtStore *store0 = frt_open_ram_store();
1830
- FrtStore *store1 = frt_open_ram_store();
1826
+ FrtStore *store0 = frt_open_ram_store(NULL);
1827
+ FrtStore *store1 = frt_open_ram_store(NULL);
1831
1828
 
1832
1829
  FrtIndexReader *ir0, *ir1;
1833
1830
  FrtSearcher **searchers;
@@ -1843,8 +1840,8 @@ TestSuite *ts_multi_search(TestSuite *suite)
1843
1840
  prepare_multi_search_index(store0, test_data, 9, 1);
1844
1841
  prepare_multi_search_index(store1, test_data + 9, FRT_NELEMS(test_data) - 9, 10);
1845
1842
 
1846
- ir0 = frt_ir_open(store0);
1847
- ir1 = frt_ir_open(store1);
1843
+ ir0 = frt_ir_open(NULL, store0);
1844
+ ir1 = frt_ir_open(NULL, store1);
1848
1845
  searchers = FRT_ALLOC_N(FrtSearcher *, 2);
1849
1846
  searchers[0] = frt_isea_new(ir0);
1850
1847
  searchers[1] = frt_isea_new(ir1);
@@ -1870,4 +1867,3 @@ TestSuite *ts_multi_search(TestSuite *suite)
1870
1867
  frt_searcher_close(searcher);
1871
1868
  return suite;
1872
1869
  }
1873
-
@@ -16,9 +16,10 @@
16
16
  #define Asi_has_vals(si, name, doc_cnt, store)\
17
17
  tst_si_eql(__LINE__, tc, si, name, doc_cnt, store)
18
18
  static FrtFieldInfos dummy_fis = {
19
- FRT_STORE_NO, /* store */
20
- FRT_INDEX_NO, /* index */
21
- FRT_TERM_VECTOR_NO, /* term_vector */
19
+ FRT_STORE_NO, /* store */
20
+ FRT_COMPRESSION_NONE, /* compression */
21
+ FRT_INDEX_NO, /* index */
22
+ FRT_TERM_VECTOR_NO, /* term_vector */
22
23
  0, /* size */
23
24
  0, /* capa */
24
25
  NULL, /* fields */
@@ -154,7 +155,7 @@ void test_sis_rw(TestCase *tc, void *data)
154
155
 
155
156
  TestSuite *ts_segments(TestSuite *suite)
156
157
  {
157
- FrtStore *store = frt_open_ram_store();
158
+ FrtStore *store = frt_open_ram_store(NULL);
158
159
 
159
160
  suite = ADD_SUITE(suite);
160
161
 
@@ -3,9 +3,11 @@
3
3
  #include "frt_search.h"
4
4
  #include "test.h"
5
5
 
6
+ #undef close
7
+
6
8
  #define ARRAY_SIZE 20
7
9
 
8
- static FrtSymbol search, string, integer, flt;
10
+ static ID search, string, integer, flt;
9
11
 
10
12
  typedef struct SortTestData {
11
13
  const char *search;
@@ -17,10 +19,11 @@ typedef struct SortTestData {
17
19
  static void add_sort_test_data(SortTestData *std, FrtIndexWriter *iw)
18
20
  {
19
21
  FrtDocument *doc = frt_doc_new();
20
- frt_doc_add_field(doc, frt_df_add_data(frt_df_new(search), (char *)std->search));
21
- frt_doc_add_field(doc, frt_df_add_data(frt_df_new(string), (char *)std->string));
22
- frt_doc_add_field(doc, frt_df_add_data(frt_df_new(integer), (char *)std->integer));
23
- frt_doc_add_field(doc, frt_df_add_data(frt_df_new(flt), (char *)std->flt));
22
+ rb_encoding *enc = rb_enc_find("ASCII-8BIT");
23
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(search), (char *)std->search, enc));
24
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(string), (char *)std->string, enc));
25
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(integer), (char *)std->integer, enc));
26
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(flt), (char *)std->flt, enc));
24
27
 
25
28
  sscanf(std->flt, "%f", &doc->boost);
26
29
 
@@ -45,11 +48,11 @@ static void sort_test_setup(FrtStore *store)
45
48
  {
46
49
  int i;
47
50
  FrtIndexWriter *iw;
48
- FrtFieldInfos *fis = frt_fis_new(FRT_STORE_YES, FRT_INDEX_YES, FRT_TERM_VECTOR_YES);
51
+ FrtFieldInfos *fis = frt_fis_new(FRT_STORE_YES, FRT_COMPRESSION_NONE, FRT_INDEX_YES, FRT_TERM_VECTOR_YES);
49
52
  frt_index_create(store, fis);
50
53
  frt_fis_deref(fis);
51
54
 
52
- iw = frt_iw_open(store, frt_whitespace_analyzer_new(false), NULL);
55
+ iw = frt_iw_open(NULL, store, frt_whitespace_analyzer_new(false), NULL);
53
56
 
54
57
  for (i = 0; i < FRT_NELEMS(data); i++) {
55
58
  add_sort_test_data(&data[i], iw);
@@ -60,21 +63,21 @@ static void sort_test_setup(FrtStore *store)
60
63
  static void sort_multi_test_setup(FrtStore *store1, FrtStore *store2)
61
64
  {
62
65
  int i;
63
- FrtFieldInfos *fis = frt_fis_new(FRT_STORE_YES, FRT_INDEX_YES, FRT_TERM_VECTOR_YES);
66
+ FrtFieldInfos *fis = frt_fis_new(FRT_STORE_YES, FRT_COMPRESSION_NONE, FRT_INDEX_YES, FRT_TERM_VECTOR_YES);
64
67
  FrtIndexWriter *iw;
65
68
 
66
69
  frt_index_create(store1, fis);
67
70
  frt_index_create(store2, fis);
68
71
  frt_fis_deref(fis);
69
72
 
70
- iw = frt_iw_open(store1, frt_whitespace_analyzer_new(false), NULL);
73
+ iw = frt_iw_open(NULL, store1, frt_whitespace_analyzer_new(false), NULL);
71
74
 
72
75
  for (i = 0; i < FRT_NELEMS(data)/2; i++) {
73
76
  add_sort_test_data(&data[i], iw);
74
77
  }
75
78
  frt_iw_close(iw);
76
79
 
77
- iw = frt_iw_open(store2, frt_whitespace_analyzer_new(false), NULL);
80
+ iw = frt_iw_open(NULL, store2, frt_whitespace_analyzer_new(false), NULL);
78
81
 
79
82
  for (i = FRT_NELEMS(data)/2; i < FRT_NELEMS(data); i++) {
80
83
  add_sort_test_data(&data[i], iw);
@@ -288,7 +291,7 @@ static void test_sorts(TestCase *tc, void *data)
288
291
  TestSuite *ts_sort(TestSuite *suite)
289
292
  {
290
293
  FrtSearcher *sea, **searchers;
291
- FrtStore *store = frt_open_ram_store(), *fs_store;
294
+ FrtStore *store = frt_open_ram_store(NULL), *fs_store;
292
295
 
293
296
  search = rb_intern("search");
294
297
  string = rb_intern("string");
@@ -302,7 +305,7 @@ TestSuite *ts_sort(TestSuite *suite)
302
305
  tst_run_test(suite, test_sort_field_to_s, NULL);
303
306
  tst_run_test(suite, test_sort_to_s, NULL);
304
307
 
305
- sea = frt_isea_new(frt_ir_open(store));
308
+ sea = frt_isea_new(frt_ir_open(NULL, store));
306
309
 
307
310
  tst_run_test(suite, test_sorts, (void *)sea);
308
311
 
@@ -319,8 +322,8 @@ TestSuite *ts_sort(TestSuite *suite)
319
322
 
320
323
  searchers = FRT_ALLOC_N(FrtSearcher *, 2);
321
324
 
322
- searchers[0] = frt_isea_new(frt_ir_open(store));
323
- searchers[1] = frt_isea_new(frt_ir_open(fs_store));
325
+ searchers[0] = frt_isea_new(frt_ir_open(NULL, store));
326
+ searchers[1] = frt_isea_new(frt_ir_open(NULL, fs_store));
324
327
 
325
328
  sea = frt_msea_new(searchers, 2, true);
326
329
  tst_run_test(suite, test_sorts, (void *)sea);
@@ -3,6 +3,8 @@
3
3
  #include <limits.h>
4
4
  #include "test.h"
5
5
 
6
+ #undef rename
7
+
6
8
  #define TEST_LOCK_NAME "test"
7
9
 
8
10
  typedef struct WithLockTestArg {
@@ -1,6 +1,8 @@
1
1
  #include "frt_index.h"
2
2
  #include "test.h"
3
3
 
4
+ #undef close
5
+
4
6
  /***************************************************************************
5
7
  *
6
8
  * FrtTermInfosWriter
@@ -336,7 +338,7 @@ static void test_term_infos_reader(TestCase *tc, void *data)
336
338
 
337
339
  TestSuite *ts_term(TestSuite *suite)
338
340
  {
339
- FrtStore *store = frt_open_ram_store();
341
+ FrtStore *store = frt_open_ram_store(NULL);
340
342
 
341
343
  suite = ADD_SUITE(suite);
342
344
 
@@ -33,14 +33,13 @@ static void test_posting(TestCase *tc, void *data)
33
33
  Apnull(pl->last_occ->next);
34
34
  }
35
35
 
36
- static FrtFieldInfos *create_tv_fis()
37
- {
38
- FrtFieldInfos *fis = frt_fis_new(FRT_STORE_NO, FRT_INDEX_UNTOKENIZED, FRT_TERM_VECTOR_NO);
39
- frt_fis_add_field(fis, frt_fi_new(rb_intern("tv"), FRT_STORE_NO, FRT_INDEX_UNTOKENIZED, FRT_TERM_VECTOR_YES));
40
- frt_fis_add_field(fis, frt_fi_new(rb_intern("tv2"), FRT_STORE_NO, FRT_INDEX_UNTOKENIZED, FRT_TERM_VECTOR_YES));
41
- frt_fis_add_field(fis, frt_fi_new(rb_intern("tv_with_positions"), FRT_STORE_NO, FRT_INDEX_UNTOKENIZED, FRT_TERM_VECTOR_WITH_POSITIONS));
42
- frt_fis_add_field(fis, frt_fi_new(rb_intern("tv_with_offsets"), FRT_STORE_NO, FRT_INDEX_UNTOKENIZED, FRT_TERM_VECTOR_WITH_OFFSETS));
43
- frt_fis_add_field(fis, frt_fi_new(rb_intern("tv_with_positions_offsets"), FRT_STORE_NO, FRT_INDEX_UNTOKENIZED, FRT_TERM_VECTOR_WITH_POSITIONS_OFFSETS));
36
+ static FrtFieldInfos *create_tv_fis(void) {
37
+ FrtFieldInfos *fis = frt_fis_new(FRT_STORE_NO, FRT_COMPRESSION_NONE, FRT_INDEX_UNTOKENIZED, FRT_TERM_VECTOR_NO);
38
+ frt_fis_add_field(fis, frt_fi_new(rb_intern("tv"), FRT_STORE_NO, FRT_COMPRESSION_NONE, FRT_INDEX_UNTOKENIZED, FRT_TERM_VECTOR_YES));
39
+ frt_fis_add_field(fis, frt_fi_new(rb_intern("tv2"), FRT_STORE_NO, FRT_COMPRESSION_NONE, FRT_INDEX_UNTOKENIZED, FRT_TERM_VECTOR_YES));
40
+ frt_fis_add_field(fis, frt_fi_new(rb_intern("tv_with_positions"), FRT_STORE_NO, FRT_COMPRESSION_NONE, FRT_INDEX_UNTOKENIZED, FRT_TERM_VECTOR_WITH_POSITIONS));
41
+ frt_fis_add_field(fis, frt_fi_new(rb_intern("tv_with_offsets"), FRT_STORE_NO, FRT_COMPRESSION_NONE, FRT_INDEX_UNTOKENIZED, FRT_TERM_VECTOR_WITH_OFFSETS));
42
+ frt_fis_add_field(fis, frt_fi_new(rb_intern("tv_with_positions_offsets"), FRT_STORE_NO, FRT_COMPRESSION_NONE, FRT_INDEX_UNTOKENIZED, FRT_TERM_VECTOR_WITH_POSITIONS_OFFSETS));
44
43
  return fis;
45
44
  }
46
45
 
@@ -85,7 +84,7 @@ static FrtOffset *create_tv_offsets(FrtMemoryPool *mp)
85
84
  static void test_tv_single_doc(TestCase *tc, void *data)
86
85
  {
87
86
  int i, j;
88
- FrtStore *store = frt_open_ram_store();
87
+ FrtStore *store = frt_open_ram_store(NULL);
89
88
  FrtMemoryPool *mp = (FrtMemoryPool *)data;
90
89
  FrtFieldsReader *fr;
91
90
  FrtFieldsWriter *fw;
@@ -227,7 +226,7 @@ static void test_tv_single_doc(TestCase *tc, void *data)
227
226
  static void test_tv_multi_doc(TestCase *tc, void *data)
228
227
  {
229
228
  int i, j;
230
- FrtStore *store = frt_open_ram_store();
229
+ FrtStore *store = frt_open_ram_store(NULL);
231
230
  FrtMemoryPool *mp = (FrtMemoryPool *)data;
232
231
  FrtFieldsReader *fr;
233
232
  FrtFieldsWriter *fw;
@@ -1,8 +1,7 @@
1
1
  #include "frt_except.h"
2
2
  #include "test.h"
3
3
 
4
- static void raise_eof()
5
- {
4
+ static void raise_eof(void) {
6
5
  FRT_RAISE(FRT_EOF_ERROR, "Error, end of file");
7
6
  }
8
7
 
@@ -71,12 +71,12 @@ static void do_add_doc(FrtIndex *index)
71
71
  {
72
72
  FrtDocument *doc = frt_doc_new();
73
73
  int n = rand();
74
-
75
- frt_doc_add_field(doc, frt_df_add_data(frt_df_new(id), frt_strfmt("%d", n)))->destroy_data = true;
76
- frt_doc_add_field(doc, frt_df_add_data(frt_df_new(contents), num_to_str(n)))->destroy_data = true;
74
+ rb_encoding *enc = rb_enc_find("ASCII-8BIT");
75
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(id), frt_strfmt("%d", n), enc))->destroy_data = true;
76
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(contents), num_to_str(n), enc))->destroy_data = true;
77
77
  tlog("Adding %d\n", n);
78
78
  frt_index_add_doc(index, doc);
79
- frt_doc_destroy(doc);
79
+ frt_doc_destroy(doc);
80
80
  }
81
81
 
82
82
  static void do_search(FrtIndex *index)
@@ -84,17 +84,18 @@ static void do_search(FrtIndex *index)
84
84
  int n = rand(), i;
85
85
  char *query = num_to_str(n);
86
86
  FrtTopDocs *td;
87
+ rb_encoding *enc = rb_enc_find("ASCII-8BIT");
87
88
 
88
89
  tlog("Searching for %d\n", n);
89
90
 
90
91
  frt_mutex_lock(&index->mutex);
91
- td = frt_index_search_str(index, query, 0, 3, NULL, NULL, NULL);
92
+ td = frt_index_search_str(index, query, 0, 3, NULL, NULL, NULL, enc);
92
93
  free(query);
93
94
  for (i = 0; i < td->size; i++) {
94
95
  FrtHit *hit = td->hits[i];
95
96
  FrtDocument *doc = frt_index_get_doc(index, hit->doc);
96
97
  tlog("Hit for %d: %s - %f\n", hit->doc, frt_doc_get_field(doc, id)->data[0], hit->score);
97
- frt_doc_destroy(doc);
98
+ frt_doc_destroy(doc);
98
99
  }
99
100
  tlog("Searched for %d: total = %d\n", n, td->total_hits);
100
101
  frt_mutex_unlock(&index->mutex);
@@ -157,10 +158,8 @@ TestSuite *ts_threading(TestSuite *suite)
157
158
  FrtStore *store = frt_open_fs_store("./test/testdir/store");
158
159
  FrtIndex *index;
159
160
  FrtHashSet *def_fields = frt_hs_new_ptr(NULL);
160
- FrtFieldInfos *fis = frt_fis_new(FRT_STORE_YES, FRT_INDEX_YES,
161
- FRT_TERM_VECTOR_WITH_POSITIONS_OFFSETS);
162
- frt_fis_add_field(fis, frt_fi_new(id, FRT_STORE_YES, FRT_INDEX_UNTOKENIZED,
163
- FRT_TERM_VECTOR_YES));
161
+ FrtFieldInfos *fis = frt_fis_new(FRT_STORE_YES, FRT_COMPRESSION_NONE, FRT_INDEX_YES, FRT_TERM_VECTOR_WITH_POSITIONS_OFFSETS);
162
+ frt_fis_add_field(fis, frt_fi_new(id, FRT_STORE_YES, FRT_COMPRESSION_NONE, FRT_INDEX_UNTOKENIZED, FRT_TERM_VECTOR_YES));
164
163
  frt_index_create(store, fis);
165
164
  frt_fis_deref(fis);
166
165
 
@@ -555,7 +555,6 @@ char *num_to_str(int num)
555
555
  return res;
556
556
  }
557
557
 
558
- FILE *temp_open()
559
- {
558
+ FILE *temp_open(void) {
560
559
  return fopen("test/testdir/tmp", "w+");
561
560
  }
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Ferret
3
- VERSION = '0.12.7'
3
+ VERSION = '0.13.2'
4
4
  end
5
5
  end