isomorfeus-ferret 0.12.7 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +101 -19
  3. data/README.md +54 -1
  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/bzip_blocksort.c +1094 -0
  11. data/ext/isomorfeus_ferret_ext/bzip_huffman.c +205 -0
  12. data/ext/isomorfeus_ferret_ext/bzlib.c +1572 -0
  13. data/ext/isomorfeus_ferret_ext/bzlib.h +282 -0
  14. data/ext/isomorfeus_ferret_ext/bzlib_compress.c +672 -0
  15. data/ext/isomorfeus_ferret_ext/bzlib_crctable.c +104 -0
  16. data/ext/isomorfeus_ferret_ext/bzlib_decompress.c +652 -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 +492 -474
  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 +105 -63
  40. data/ext/isomorfeus_ferret_ext/frt_global.h +7 -3
  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 +580 -399
  45. data/ext/isomorfeus_ferret_ext/frt_index.h +272 -291
  46. data/ext/isomorfeus_ferret_ext/frt_mempool.c +1 -2
  47. data/ext/isomorfeus_ferret_ext/frt_multimapper.c +4 -7
  48. data/ext/isomorfeus_ferret_ext/frt_q_boolean.c +67 -91
  49. data/ext/isomorfeus_ferret_ext/frt_q_const_score.c +35 -38
  50. data/ext/isomorfeus_ferret_ext/frt_q_filtered_query.c +53 -72
  51. data/ext/isomorfeus_ferret_ext/frt_q_fuzzy.c +25 -32
  52. data/ext/isomorfeus_ferret_ext/frt_q_match_all.c +21 -23
  53. data/ext/isomorfeus_ferret_ext/frt_q_multi_term.c +66 -103
  54. data/ext/isomorfeus_ferret_ext/frt_q_parser.c +207 -195
  55. data/ext/isomorfeus_ferret_ext/frt_q_phrase.c +20 -16
  56. data/ext/isomorfeus_ferret_ext/frt_q_prefix.c +17 -14
  57. data/ext/isomorfeus_ferret_ext/frt_q_range.c +102 -131
  58. data/ext/isomorfeus_ferret_ext/frt_q_span.c +179 -178
  59. data/ext/isomorfeus_ferret_ext/frt_q_term.c +47 -60
  60. data/ext/isomorfeus_ferret_ext/frt_q_wildcard.c +18 -16
  61. data/ext/isomorfeus_ferret_ext/frt_ram_store.c +45 -84
  62. data/ext/isomorfeus_ferret_ext/frt_search.c +105 -146
  63. data/ext/isomorfeus_ferret_ext/frt_search.h +331 -320
  64. data/ext/isomorfeus_ferret_ext/frt_similarity.c +5 -13
  65. data/ext/isomorfeus_ferret_ext/frt_similarity.h +7 -12
  66. data/ext/isomorfeus_ferret_ext/frt_sort.c +105 -149
  67. data/ext/isomorfeus_ferret_ext/frt_store.c +13 -7
  68. data/ext/isomorfeus_ferret_ext/frt_store.h +10 -2
  69. data/ext/isomorfeus_ferret_ext/frt_threading.h +0 -1
  70. data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.c +21 -109
  71. data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.h +2 -32
  72. data/ext/isomorfeus_ferret_ext/lz4.c +2495 -0
  73. data/ext/isomorfeus_ferret_ext/lz4.h +774 -0
  74. data/ext/isomorfeus_ferret_ext/lz4frame.c +1899 -0
  75. data/ext/isomorfeus_ferret_ext/lz4frame.h +623 -0
  76. data/ext/isomorfeus_ferret_ext/lz4hc.c +1615 -0
  77. data/ext/isomorfeus_ferret_ext/lz4hc.h +413 -0
  78. data/ext/isomorfeus_ferret_ext/lz4xxhash.c +1030 -0
  79. data/ext/isomorfeus_ferret_ext/lz4xxhash.h +328 -0
  80. data/ext/isomorfeus_ferret_ext/stem_modules.h +0 -86
  81. data/ext/isomorfeus_ferret_ext/test.c +1 -2
  82. data/ext/isomorfeus_ferret_ext/test_1710.c +11 -12
  83. data/ext/isomorfeus_ferret_ext/test_analysis.c +590 -583
  84. data/ext/isomorfeus_ferret_ext/test_compound_io.c +1 -1
  85. data/ext/isomorfeus_ferret_ext/test_document.c +19 -15
  86. data/ext/isomorfeus_ferret_ext/test_except.c +1 -2
  87. data/ext/isomorfeus_ferret_ext/test_fields.c +59 -60
  88. data/ext/isomorfeus_ferret_ext/test_file_deleter.c +10 -27
  89. data/ext/isomorfeus_ferret_ext/test_filter.c +11 -8
  90. data/ext/isomorfeus_ferret_ext/test_hash.c +2 -2
  91. data/ext/isomorfeus_ferret_ext/test_hashset.c +1 -1
  92. data/ext/isomorfeus_ferret_ext/test_highlighter.c +15 -11
  93. data/ext/isomorfeus_ferret_ext/test_index.c +372 -365
  94. data/ext/isomorfeus_ferret_ext/test_q_const_score.c +5 -3
  95. data/ext/isomorfeus_ferret_ext/test_q_filtered.c +5 -3
  96. data/ext/isomorfeus_ferret_ext/test_q_fuzzy.c +13 -10
  97. data/ext/isomorfeus_ferret_ext/test_q_parser.c +45 -7
  98. data/ext/isomorfeus_ferret_ext/test_q_span.c +15 -12
  99. data/ext/isomorfeus_ferret_ext/test_ram_store.c +3 -3
  100. data/ext/isomorfeus_ferret_ext/test_search.c +60 -62
  101. data/ext/isomorfeus_ferret_ext/test_segments.c +5 -4
  102. data/ext/isomorfeus_ferret_ext/test_sort.c +17 -14
  103. data/ext/isomorfeus_ferret_ext/test_store.c +2 -0
  104. data/ext/isomorfeus_ferret_ext/test_term.c +3 -1
  105. data/ext/isomorfeus_ferret_ext/test_term_vectors.c +9 -10
  106. data/ext/isomorfeus_ferret_ext/test_test.c +1 -2
  107. data/ext/isomorfeus_ferret_ext/test_threading.c +9 -10
  108. data/ext/isomorfeus_ferret_ext/testhelper.c +1 -2
  109. data/lib/isomorfeus/ferret/version.rb +1 -1
  110. metadata +27 -57
  111. data/ext/isomorfeus_ferret_ext/email.rl +0 -21
  112. data/ext/isomorfeus_ferret_ext/frt_scanner.c +0 -900
  113. data/ext/isomorfeus_ferret_ext/frt_scanner.h +0 -28
  114. data/ext/isomorfeus_ferret_ext/frt_scanner_mb.c +0 -6706
  115. data/ext/isomorfeus_ferret_ext/frt_scanner_utf8.c +0 -4420
  116. data/ext/isomorfeus_ferret_ext/scanner.h +0 -28
  117. data/ext/isomorfeus_ferret_ext/scanner.in +0 -43
  118. data/ext/isomorfeus_ferret_ext/scanner.rl +0 -84
  119. data/ext/isomorfeus_ferret_ext/scanner_mb.rl +0 -200
  120. data/ext/isomorfeus_ferret_ext/scanner_utf8.rl +0 -85
  121. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_basque.c +0 -1167
  122. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_basque.h +0 -6
  123. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_catalan.c +0 -1433
  124. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_catalan.h +0 -6
  125. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_danish.c +0 -301
  126. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_danish.h +0 -6
  127. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_dutch.c +0 -590
  128. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_dutch.h +0 -6
  129. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_english.c +0 -1049
  130. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_english.h +0 -6
  131. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_finnish.c +0 -705
  132. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_finnish.h +0 -6
  133. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_french.c +0 -1239
  134. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_french.h +0 -6
  135. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_german.c +0 -477
  136. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_german.h +0 -6
  137. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_hungarian.c +0 -1217
  138. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_hungarian.h +0 -7
  139. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_indonesian.c +0 -394
  140. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_indonesian.h +0 -6
  141. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_irish.c +0 -457
  142. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_irish.h +0 -6
  143. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_italian.c +0 -1009
  144. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_italian.h +0 -6
  145. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_norwegian.c +0 -259
  146. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_norwegian.h +0 -6
  147. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_porter.c +0 -704
  148. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_porter.h +0 -6
  149. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_portuguese.c +0 -948
  150. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_portuguese.h +0 -6
  151. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_spanish.c +0 -1028
  152. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_spanish.h +0 -6
  153. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_swedish.c +0 -275
  154. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_swedish.h +0 -6
  155. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_hungarian.c +0 -849
  156. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_hungarian.h +0 -6
  157. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_romanian.c +0 -952
  158. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_romanian.h +0 -6
  159. data/ext/isomorfeus_ferret_ext/stem_KOI8_R_russian.c +0 -669
  160. data/ext/isomorfeus_ferret_ext/stem_KOI8_R_russian.h +0 -6
  161. data/ext/isomorfeus_ferret_ext/stem_modules.txt +0 -63
  162. data/ext/isomorfeus_ferret_ext/uchar-ucs4.rl +0 -1854
  163. data/ext/isomorfeus_ferret_ext/uchar-utf8.rl +0 -1999
  164. 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);
@@ -318,7 +318,7 @@ void tst_check_hits(TestCase *tc, FrtSearcher *searcher, FrtQuery *query, const
318
318
  }
319
319
 
320
320
  void check_match_vector(TestCase *tc, FrtSearcher *searcher, FrtQuery *query,
321
- int doc, FrtSymbol field, const char *ranges)
321
+ int doc, ID field, const char *ranges)
322
322
  {
323
323
  static int range_array[ARRAY_SIZE];
324
324
  FrtMatchVector *mv = frt_searcher_get_match_vector(searcher, query, doc, field);
@@ -342,11 +342,11 @@ static void test_term_query(TestCase *tc, void *data)
342
342
  char *t, e[100];
343
343
  FrtQuery *tq = frt_tq_new(field, "word2");
344
344
  check_to_s(tc, tq, field, "word2");
345
- check_to_s(tc, tq, (FrtSymbol)NULL, "field:word2");
345
+ check_to_s(tc, tq, (ID)NULL, "field:word2");
346
346
  tq->boost = 100;
347
347
  tst_check_hits(tc, searcher, tq, "4, 8, 1", -1);
348
348
  check_to_s(tc, tq, field, "word2^100.0");
349
- check_to_s(tc, tq, (FrtSymbol)NULL, "field:word2^100.0");
349
+ check_to_s(tc, tq, (ID)NULL, "field:word2^100.0");
350
350
 
351
351
  /* test TermWeight.to_s */
352
352
  w = searcher->create_weight(searcher, tq);
@@ -554,13 +554,13 @@ static void test_phrase_query(TestCase *tc, void *data)
554
554
  FrtWeight *w;
555
555
  char *t, e[100];
556
556
  check_to_s(tc, phq, field, "\"\"");
557
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"\"");
557
+ check_to_s(tc, phq, (ID)NULL, "field:\"\"");
558
558
 
559
559
  frt_phq_add_term(phq, "quick", 1);
560
560
  frt_phq_add_term(phq, "brown", 1);
561
561
  frt_phq_add_term(phq, "fox", 1);
562
562
  check_to_s(tc, phq, field, "\"quick brown fox\"");
563
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"quick brown fox\"");
563
+ check_to_s(tc, phq, (ID)NULL, "field:\"quick brown fox\"");
564
564
  tst_check_hits(tc, searcher, phq, "1", 1);
565
565
 
566
566
  frt_phq_set_slop(phq, 4);
@@ -581,7 +581,7 @@ static void test_phrase_query(TestCase *tc, void *data)
581
581
  frt_phq_add_term(phq, "quick", 1);
582
582
  frt_phq_add_term(phq, "fox", 2);
583
583
  check_to_s(tc, phq, field, "\"quick <> fox\"");
584
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"quick <> fox\"");
584
+ check_to_s(tc, phq, (ID)NULL, "field:\"quick <> fox\"");
585
585
  tst_check_hits(tc, searcher, phq, "1, 11, 14", 14);
586
586
 
587
587
  frt_phq_set_slop(phq, 1);
@@ -590,19 +590,19 @@ static void test_phrase_query(TestCase *tc, void *data)
590
590
  frt_phq_set_slop(phq, 4);
591
591
  tst_check_hits(tc, searcher, phq, "1, 11, 14, 16, 17", 14);
592
592
  frt_phq_add_term(phq, "red", -1);
593
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"quick red fox\"~4");
593
+ check_to_s(tc, phq, (ID)NULL, "field:\"quick red fox\"~4");
594
594
  tst_check_hits(tc, searcher, phq, "11", 11);
595
595
  frt_phq_add_term(phq, "RED", 0);
596
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"quick red RED&fox\"~4");
596
+ check_to_s(tc, phq, (ID)NULL, "field:\"quick red RED&fox\"~4");
597
597
  tst_check_hits(tc, searcher, phq, "11", 11);
598
598
  frt_phq_add_term(phq, "QUICK", -1);
599
599
  frt_phq_add_term(phq, "red", 0);
600
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"quick QUICK&red&red RED&fox\"~4");
600
+ check_to_s(tc, phq, (ID)NULL, "field:\"quick QUICK&red&red RED&fox\"~4");
601
601
  tst_check_hits(tc, searcher, phq, "11", 11);
602
602
  frt_phq_add_term(phq, "green", 0);
603
603
  frt_phq_add_term(phq, "yellow", 0);
604
604
  frt_phq_add_term(phq, "sentinel", 1);
605
- check_to_s(tc, phq, (FrtSymbol)NULL,
605
+ check_to_s(tc, phq, (ID)NULL,
606
606
  "field:\"quick QUICK&red&red RED&fox&green&yellow sentinel\"~4");
607
607
  tst_check_hits(tc, searcher, phq, "", -1);
608
608
  frt_q_deref(phq);
@@ -615,7 +615,7 @@ static void test_phrase_query(TestCase *tc, void *data)
615
615
  frt_phq_add_term(phq, "quick", 0);
616
616
  frt_phq_add_term(phq, "QUICK", 1);
617
617
  tst_check_hits(tc, searcher, phq, "11, 14", 14);
618
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"WORD3&the THE&quick QUICK\"");
618
+ check_to_s(tc, phq, (ID)NULL, "field:\"WORD3&the THE&quick QUICK\"");
619
619
  frt_q_deref(phq);
620
620
 
621
621
  /* test repeating terms check */
@@ -740,30 +740,30 @@ static void test_multi_phrase_query(TestCase *tc, void *data)
740
740
  frt_phq_append_multi_term(phq, "fast");
741
741
  tst_check_hits(tc, searcher, phq, "1, 8, 11, 14, 16, 17", -1);
742
742
  check_to_s(tc, phq, field, "\"quick|fast\"");
743
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"quick|fast\"");
743
+ check_to_s(tc, phq, (ID)NULL, "field:\"quick|fast\"");
744
744
 
745
745
  frt_phq_add_term(phq, "brown", 1);
746
746
  frt_phq_append_multi_term(phq, "red");
747
747
  frt_phq_append_multi_term(phq, "hairy");
748
748
  frt_phq_add_term(phq, "fox", 1);
749
749
  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\"");
750
+ check_to_s(tc, phq, (ID)NULL, "field:\"quick|fast brown|red|hairy fox\"");
751
751
  tst_check_hits(tc, searcher, phq, "1, 8, 11, 14", -1);
752
752
 
753
753
  frt_phq_set_slop(phq, 4);
754
754
  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");
755
+ check_to_s(tc, phq, (ID)NULL, "field:\"quick|fast brown|red|hairy fox\"~4");
756
756
 
757
757
  frt_phq_add_term(phq, "QUICK", -1);
758
758
  frt_phq_append_multi_term(phq, "FAST");
759
759
  tst_check_hits(tc, searcher, phq, "1, 8, 11, 14, 16, 17", -1);
760
- check_to_s(tc, phq, (FrtSymbol)NULL,
760
+ check_to_s(tc, phq, (ID)NULL,
761
761
  "field:\"quick|fast QUICK|FAST&brown|red|hairy fox\"~4");
762
762
 
763
763
  frt_phq_add_term(phq, "WORD3", -3);
764
764
  frt_phq_append_multi_term(phq, "WORD2");
765
765
  tst_check_hits(tc, searcher, phq, "1, 8, 11, 14", -1);
766
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"WORD3|WORD2 quick|fast "
766
+ check_to_s(tc, phq, (ID)NULL, "field:\"WORD3|WORD2 quick|fast "
767
767
  "QUICK|FAST&brown|red|hairy fox\"~4");
768
768
 
769
769
  frt_q_deref(phq);
@@ -776,11 +776,11 @@ static void test_multi_phrase_query(TestCase *tc, void *data)
776
776
  frt_phq_add_term(phq, "two", 1);
777
777
  frt_phq_add_term(phq, "one", 1);
778
778
  tst_check_hits(tc, searcher, phq, "2", -1);
779
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"WORD3|x&one two one\"");
779
+ check_to_s(tc, phq, (ID)NULL, "field:\"WORD3|x&one two one\"");
780
780
 
781
781
  frt_phq_set_slop(phq, 4);
782
782
  tst_check_hits(tc, searcher, phq, "2", -1);
783
- check_to_s(tc, phq, (FrtSymbol)NULL, "field:\"WORD3|x&one two one\"~4");
783
+ check_to_s(tc, phq, (ID)NULL, "field:\"WORD3|x&one two one\"~4");
784
784
  frt_q_deref(phq);
785
785
 
786
786
  /* test phrase query on non-existing field doesn't break anything */
@@ -900,40 +900,40 @@ static void test_multi_term_query(TestCase *tc, void *data)
900
900
  mtq = frt_multi_tq_new_conf(field, 4, 0.5);
901
901
  tst_check_hits(tc, searcher, mtq, "", -1);
902
902
  check_to_s(tc, mtq, field, "\"\"");
903
- check_to_s(tc, mtq, (FrtSymbol)NULL, "field:\"\"");
903
+ check_to_s(tc, mtq, (ID)NULL, "field:\"\"");
904
904
 
905
905
  frt_multi_tq_add_term(mtq, "brown");
906
906
  tst_check_hits(tc, searcher, mtq, "1, 8, 16, 17", -1);
907
907
  check_to_s(tc, mtq, field, "\"brown\"");
908
- check_to_s(tc, mtq, (FrtSymbol)NULL, "field:\"brown\"");
908
+ check_to_s(tc, mtq, (ID)NULL, "field:\"brown\"");
909
909
 
910
910
 
911
911
  /* 0.4f boost is below the 0.5 threshold so term is ignored */
912
912
  frt_multi_tq_add_term_boost(mtq, "fox", 0.4f);
913
913
  tst_check_hits(tc, searcher, mtq, "1, 8, 16, 17", -1);
914
914
  check_to_s(tc, mtq, field, "\"brown\"");
915
- check_to_s(tc, mtq, (FrtSymbol)NULL, "field:\"brown\"");
915
+ check_to_s(tc, mtq, (ID)NULL, "field:\"brown\"");
916
916
 
917
917
  /* 0.6f boost is above the 0.5 threshold so term is included */
918
918
  frt_multi_tq_add_term_boost(mtq, "fox", 0.6f);
919
919
  tst_check_hits(tc, searcher, mtq, "1, 8, 11, 14, 16, 17", -1);
920
920
  check_to_s(tc, mtq, field, "\"fox^0.6|brown\"");
921
- check_to_s(tc, mtq, (FrtSymbol)NULL, "field:\"fox^0.6|brown\"");
921
+ check_to_s(tc, mtq, (ID)NULL, "field:\"fox^0.6|brown\"");
922
922
 
923
923
  frt_multi_tq_add_term_boost(mtq, "fast", 50.0f);
924
924
  tst_check_hits(tc, searcher, mtq, "1, 8, 11, 14, 16, 17", 8);
925
925
  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\"");
926
+ check_to_s(tc, mtq, (ID)NULL, "field:\"fox^0.6|brown|fast^50.0\"");
927
927
 
928
928
 
929
929
  mtq->boost = 80.1f;
930
- check_to_s(tc, mtq, (FrtSymbol)NULL, "field:\"fox^0.6|brown|fast^50.0\"^80.1");
930
+ check_to_s(tc, mtq, (ID)NULL, "field:\"fox^0.6|brown|fast^50.0\"^80.1");
931
931
  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");
932
+ check_to_s(tc, mtq, (ID)NULL, "field:\"fox^0.6|brown|word1|fast^50.0\"^80.1");
933
933
  frt_multi_tq_add_term(mtq, "word2");
934
- 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");
935
935
  frt_multi_tq_add_term(mtq, "word3");
936
- check_to_s(tc, mtq, (FrtSymbol)NULL, "field:\"brown|word1|word2|fast^50.0\"^80.1");
936
+ check_to_s(tc, mtq, (ID)NULL, "field:\"brown|word1|word2|fast^50.0\"^80.1");
937
937
 
938
938
  /* test MultiTermWeight.to_s */
939
939
  w = searcher->create_weight(searcher, mtq);
@@ -956,7 +956,7 @@ static void test_multi_term_query(TestCase *tc, void *data)
956
956
  frt_bq_add_query(bq, mtq, FRT_BC_MUST);
957
957
  tst_check_hits(tc, searcher, bq, "1, 11, 14, 16, 17", -1);
958
958
  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\"");
959
+ check_to_s(tc, bq, (ID)NULL, "+field:quick +field:\"fox^0.6|brown|word1\"");
960
960
  frt_q_deref(bq);
961
961
  frt_q_deref(mtq);
962
962
 
@@ -978,7 +978,7 @@ static void test_multi_term_query_hash(TestCase *tc, void *data)
978
978
  (void)data;
979
979
 
980
980
 
981
- check_to_s(tc, q1, (FrtSymbol)NULL, "field:\"\"");
981
+ check_to_s(tc, q1, (ID)NULL, "field:\"\"");
982
982
  Assert(frt_q_hash(q1) == frt_q_hash(q2), "Queries should be equal");
983
983
  Assert(frt_q_eq(q1, q1), "Same queries should be equal");
984
984
  Assert(frt_q_eq(q1, q2), "Queries should be equal");
@@ -1637,7 +1637,7 @@ static void test_search_unscored(TestCase *tc, void *data)
1637
1637
 
1638
1638
  TestSuite *ts_search(TestSuite *suite)
1639
1639
  {
1640
- FrtStore *store = frt_open_ram_store();
1640
+ FrtStore *store = frt_open_ram_store(NULL);
1641
1641
  FrtIndexReader *ir;
1642
1642
  FrtSearcher *searcher;
1643
1643
 
@@ -1653,7 +1653,7 @@ TestSuite *ts_search(TestSuite *suite)
1653
1653
  tst_run_test(suite, test_default_similarity, NULL);
1654
1654
 
1655
1655
  prepare_search_index(store);
1656
- ir = frt_ir_open(store);
1656
+ ir = frt_ir_open(NULL, store);
1657
1657
  searcher = frt_isea_new(ir);
1658
1658
 
1659
1659
  tst_run_test(suite, test_get_doc, (void *)searcher);
@@ -1702,22 +1702,21 @@ static void prepare_multi_search_index(FrtStore *store, struct Data data[],
1702
1702
  {
1703
1703
  int i;
1704
1704
  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);
1705
+ FrtFieldInfos *fis = frt_fis_new(FRT_STORE_YES, FRT_COMPRESSION_NONE, FRT_INDEX_YES, FRT_TERM_VECTOR_WITH_POSITIONS_OFFSETS);
1706
+ FrtFieldInfo *fi = frt_fi_new(rb_intern("empty-field"), FRT_STORE_NO, FRT_COMPRESSION_NONE, FRT_INDEX_NO, FRT_TERM_VECTOR_NO);
1709
1707
  frt_fis_add_field(fis, fi);
1710
1708
  frt_index_create(store, fis);
1711
1709
  frt_fis_deref(fis);
1710
+ rb_encoding *enc = rb_enc_find("ASCII-8BIT");
1712
1711
 
1713
- iw = frt_iw_open(store, dbl_analyzer_new(), NULL);
1712
+ iw = frt_iw_open(NULL, store, dbl_analyzer_new(), NULL);
1714
1713
  for (i = 0; i < d_cnt; i++) {
1715
1714
  FrtDocument *doc = frt_doc_new();
1716
1715
  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));
1716
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(date), (char *)data[i].date, enc));
1717
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(field), (char *)data[i].field, enc));
1718
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(cat), (char *)data[i].cat, enc));
1719
+ frt_doc_add_field(doc, frt_df_add_data(frt_df_new(number), (char *)data[i].number, enc));
1721
1720
  frt_iw_add_doc(iw, doc);
1722
1721
  frt_doc_destroy(doc);
1723
1722
  }
@@ -1826,8 +1825,8 @@ static void test_query_combine(TestCase *tc, void *data)
1826
1825
 
1827
1826
  TestSuite *ts_multi_search(TestSuite *suite)
1828
1827
  {
1829
- FrtStore *store0 = frt_open_ram_store();
1830
- FrtStore *store1 = frt_open_ram_store();
1828
+ FrtStore *store0 = frt_open_ram_store(NULL);
1829
+ FrtStore *store1 = frt_open_ram_store(NULL);
1831
1830
 
1832
1831
  FrtIndexReader *ir0, *ir1;
1833
1832
  FrtSearcher **searchers;
@@ -1843,8 +1842,8 @@ TestSuite *ts_multi_search(TestSuite *suite)
1843
1842
  prepare_multi_search_index(store0, test_data, 9, 1);
1844
1843
  prepare_multi_search_index(store1, test_data + 9, FRT_NELEMS(test_data) - 9, 10);
1845
1844
 
1846
- ir0 = frt_ir_open(store0);
1847
- ir1 = frt_ir_open(store1);
1845
+ ir0 = frt_ir_open(NULL, store0);
1846
+ ir1 = frt_ir_open(NULL, store1);
1848
1847
  searchers = FRT_ALLOC_N(FrtSearcher *, 2);
1849
1848
  searchers[0] = frt_isea_new(ir0);
1850
1849
  searchers[1] = frt_isea_new(ir1);
@@ -1870,4 +1869,3 @@ TestSuite *ts_multi_search(TestSuite *suite)
1870
1869
  frt_searcher_close(searcher);
1871
1870
  return suite;
1872
1871
  }
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.0'
4
4
  end
5
5
  end