isomorfeus-ferret 0.12.6 → 0.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (249) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +101 -19
  3. data/README.md +85 -16
  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_constants.c +15 -0
  9. data/ext/isomorfeus_ferret_ext/brotli_common_constants.h +200 -0
  10. data/ext/isomorfeus_ferret_ext/brotli_common_context.c +156 -0
  11. data/ext/isomorfeus_ferret_ext/brotli_common_context.h +113 -0
  12. data/ext/isomorfeus_ferret_ext/brotli_common_dictionary.c +5914 -0
  13. data/ext/isomorfeus_ferret_ext/brotli_common_dictionary.h +64 -0
  14. data/ext/isomorfeus_ferret_ext/brotli_common_platform.c +22 -0
  15. data/ext/isomorfeus_ferret_ext/brotli_common_platform.h +594 -0
  16. data/ext/isomorfeus_ferret_ext/brotli_common_transform.c +291 -0
  17. data/ext/isomorfeus_ferret_ext/brotli_common_transform.h +85 -0
  18. data/ext/isomorfeus_ferret_ext/brotli_common_version.h +26 -0
  19. data/ext/isomorfeus_ferret_ext/brotli_dec_bit_reader.c +76 -0
  20. data/ext/isomorfeus_ferret_ext/brotli_dec_bit_reader.h +351 -0
  21. data/ext/isomorfeus_ferret_ext/brotli_dec_decode.c +2608 -0
  22. data/ext/isomorfeus_ferret_ext/brotli_dec_huffman.c +339 -0
  23. data/ext/isomorfeus_ferret_ext/brotli_dec_huffman.h +121 -0
  24. data/ext/isomorfeus_ferret_ext/brotli_dec_prefix.h +732 -0
  25. data/ext/isomorfeus_ferret_ext/brotli_dec_state.c +159 -0
  26. data/ext/isomorfeus_ferret_ext/brotli_dec_state.h +365 -0
  27. data/ext/isomorfeus_ferret_ext/brotli_decode.h +344 -0
  28. data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references.c +145 -0
  29. data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references.h +39 -0
  30. data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references_hq.c +843 -0
  31. data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references_hq.h +95 -0
  32. data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references_inc.h +163 -0
  33. data/ext/isomorfeus_ferret_ext/brotli_enc_bit_cost.c +35 -0
  34. data/ext/isomorfeus_ferret_ext/brotli_enc_bit_cost.h +63 -0
  35. data/ext/isomorfeus_ferret_ext/brotli_enc_bit_cost_inc.h +127 -0
  36. data/ext/isomorfeus_ferret_ext/brotli_enc_block_encoder_inc.h +34 -0
  37. data/ext/isomorfeus_ferret_ext/brotli_enc_block_splitter.c +194 -0
  38. data/ext/isomorfeus_ferret_ext/brotli_enc_block_splitter.h +51 -0
  39. data/ext/isomorfeus_ferret_ext/brotli_enc_block_splitter_inc.h +440 -0
  40. data/ext/isomorfeus_ferret_ext/brotli_enc_brotli_bit_stream.c +1314 -0
  41. data/ext/isomorfeus_ferret_ext/brotli_enc_brotli_bit_stream.h +84 -0
  42. data/ext/isomorfeus_ferret_ext/brotli_enc_cluster.c +56 -0
  43. data/ext/isomorfeus_ferret_ext/brotli_enc_cluster.h +48 -0
  44. data/ext/isomorfeus_ferret_ext/brotli_enc_cluster_inc.h +320 -0
  45. data/ext/isomorfeus_ferret_ext/brotli_enc_command.c +28 -0
  46. data/ext/isomorfeus_ferret_ext/brotli_enc_command.h +190 -0
  47. data/ext/isomorfeus_ferret_ext/brotli_enc_compress_fragment.c +790 -0
  48. data/ext/isomorfeus_ferret_ext/brotli_enc_compress_fragment.h +61 -0
  49. data/ext/isomorfeus_ferret_ext/brotli_enc_compress_fragment_two_pass.c +645 -0
  50. data/ext/isomorfeus_ferret_ext/brotli_enc_compress_fragment_two_pass.h +54 -0
  51. data/ext/isomorfeus_ferret_ext/brotli_enc_dictionary_hash.c +1846 -0
  52. data/ext/isomorfeus_ferret_ext/brotli_enc_dictionary_hash.h +25 -0
  53. data/ext/isomorfeus_ferret_ext/brotli_enc_encode.c +1927 -0
  54. data/ext/isomorfeus_ferret_ext/brotli_enc_encoder_dict.c +33 -0
  55. data/ext/isomorfeus_ferret_ext/brotli_enc_encoder_dict.h +43 -0
  56. data/ext/isomorfeus_ferret_ext/brotli_enc_entropy_encode.c +503 -0
  57. data/ext/isomorfeus_ferret_ext/brotli_enc_entropy_encode.h +122 -0
  58. data/ext/isomorfeus_ferret_ext/brotli_enc_entropy_encode_static.h +539 -0
  59. data/ext/isomorfeus_ferret_ext/brotli_enc_fast_log.c +105 -0
  60. data/ext/isomorfeus_ferret_ext/brotli_enc_fast_log.h +66 -0
  61. data/ext/isomorfeus_ferret_ext/brotli_enc_find_match_length.h +79 -0
  62. data/ext/isomorfeus_ferret_ext/brotli_enc_hash.h +488 -0
  63. data/ext/isomorfeus_ferret_ext/brotli_enc_hash_composite_inc.h +125 -0
  64. data/ext/isomorfeus_ferret_ext/brotli_enc_hash_forgetful_chain_inc.h +293 -0
  65. data/ext/isomorfeus_ferret_ext/brotli_enc_hash_longest_match64_inc.h +267 -0
  66. data/ext/isomorfeus_ferret_ext/brotli_enc_hash_longest_match_inc.h +262 -0
  67. data/ext/isomorfeus_ferret_ext/brotli_enc_hash_longest_match_quickly_inc.h +266 -0
  68. data/ext/isomorfeus_ferret_ext/brotli_enc_hash_rolling_inc.h +212 -0
  69. data/ext/isomorfeus_ferret_ext/brotli_enc_hash_to_binary_tree_inc.h +329 -0
  70. data/ext/isomorfeus_ferret_ext/brotli_enc_histogram.c +100 -0
  71. data/ext/isomorfeus_ferret_ext/brotli_enc_histogram.h +63 -0
  72. data/ext/isomorfeus_ferret_ext/brotli_enc_histogram_inc.h +51 -0
  73. data/ext/isomorfeus_ferret_ext/brotli_enc_literal_cost.c +175 -0
  74. data/ext/isomorfeus_ferret_ext/brotli_enc_literal_cost.h +30 -0
  75. data/ext/isomorfeus_ferret_ext/brotli_enc_memory.c +170 -0
  76. data/ext/isomorfeus_ferret_ext/brotli_enc_memory.h +114 -0
  77. data/ext/isomorfeus_ferret_ext/brotli_enc_metablock.c +663 -0
  78. data/ext/isomorfeus_ferret_ext/brotli_enc_metablock.h +105 -0
  79. data/ext/isomorfeus_ferret_ext/brotli_enc_metablock_inc.h +183 -0
  80. data/ext/isomorfeus_ferret_ext/brotli_enc_params.h +46 -0
  81. data/ext/isomorfeus_ferret_ext/brotli_enc_prefix.h +53 -0
  82. data/ext/isomorfeus_ferret_ext/brotli_enc_quality.h +165 -0
  83. data/ext/isomorfeus_ferret_ext/brotli_enc_ringbuffer.h +167 -0
  84. data/ext/isomorfeus_ferret_ext/brotli_enc_static_dict.c +486 -0
  85. data/ext/isomorfeus_ferret_ext/brotli_enc_static_dict.h +40 -0
  86. data/ext/isomorfeus_ferret_ext/brotli_enc_static_dict_lut.h +5864 -0
  87. data/ext/isomorfeus_ferret_ext/brotli_enc_utf8_util.c +85 -0
  88. data/ext/isomorfeus_ferret_ext/brotli_enc_utf8_util.h +32 -0
  89. data/ext/isomorfeus_ferret_ext/brotli_enc_write_bits.h +87 -0
  90. data/ext/isomorfeus_ferret_ext/brotli_encode.h +448 -0
  91. data/ext/isomorfeus_ferret_ext/brotli_port.h +288 -0
  92. data/ext/isomorfeus_ferret_ext/brotli_types.h +83 -0
  93. data/ext/isomorfeus_ferret_ext/bzlib.c +1572 -0
  94. data/ext/isomorfeus_ferret_ext/bzlib.h +282 -0
  95. data/ext/isomorfeus_ferret_ext/bzlib_blocksort.c +1094 -0
  96. data/ext/isomorfeus_ferret_ext/bzlib_compress.c +672 -0
  97. data/ext/isomorfeus_ferret_ext/bzlib_crctable.c +104 -0
  98. data/ext/isomorfeus_ferret_ext/bzlib_decompress.c +652 -0
  99. data/ext/isomorfeus_ferret_ext/bzlib_huffman.c +205 -0
  100. data/ext/isomorfeus_ferret_ext/bzlib_private.h +509 -0
  101. data/ext/isomorfeus_ferret_ext/bzlib_randtable.c +84 -0
  102. data/ext/isomorfeus_ferret_ext/fio_tmpfile.h +53 -53
  103. data/ext/isomorfeus_ferret_ext/frb_analysis.c +785 -1192
  104. data/ext/isomorfeus_ferret_ext/frb_index.c +513 -464
  105. data/ext/isomorfeus_ferret_ext/frb_qparser.c +48 -60
  106. data/ext/isomorfeus_ferret_ext/frb_search.c +1520 -1002
  107. data/ext/isomorfeus_ferret_ext/frb_store.c +96 -96
  108. data/ext/isomorfeus_ferret_ext/frb_threading.h +0 -1
  109. data/ext/isomorfeus_ferret_ext/frb_utils.c +147 -196
  110. data/ext/isomorfeus_ferret_ext/frt_analysis.c +695 -1090
  111. data/ext/isomorfeus_ferret_ext/frt_analysis.h +174 -170
  112. data/ext/isomorfeus_ferret_ext/frt_array.c +2 -4
  113. data/ext/isomorfeus_ferret_ext/frt_bitvector.c +9 -16
  114. data/ext/isomorfeus_ferret_ext/frt_bitvector.h +32 -81
  115. data/ext/isomorfeus_ferret_ext/frt_document.c +15 -20
  116. data/ext/isomorfeus_ferret_ext/frt_document.h +10 -9
  117. data/ext/isomorfeus_ferret_ext/frt_except.c +5 -12
  118. data/ext/isomorfeus_ferret_ext/frt_field_index.c +3 -3
  119. data/ext/isomorfeus_ferret_ext/frt_field_index.h +6 -7
  120. data/ext/isomorfeus_ferret_ext/frt_filter.c +35 -46
  121. data/ext/isomorfeus_ferret_ext/frt_fs_store.c +2 -0
  122. data/ext/isomorfeus_ferret_ext/frt_global.c +91 -200
  123. data/ext/isomorfeus_ferret_ext/frt_global.h +7 -18
  124. data/ext/isomorfeus_ferret_ext/frt_hash.c +1 -2
  125. data/ext/isomorfeus_ferret_ext/frt_ind.c +32 -35
  126. data/ext/isomorfeus_ferret_ext/frt_ind.h +9 -9
  127. data/ext/isomorfeus_ferret_ext/frt_index.c +714 -384
  128. data/ext/isomorfeus_ferret_ext/frt_index.h +274 -290
  129. data/ext/isomorfeus_ferret_ext/frt_lang.c +0 -2
  130. data/ext/isomorfeus_ferret_ext/frt_mempool.c +1 -2
  131. data/ext/isomorfeus_ferret_ext/frt_multimapper.c +4 -7
  132. data/ext/isomorfeus_ferret_ext/frt_q_boolean.c +68 -91
  133. data/ext/isomorfeus_ferret_ext/frt_q_const_score.c +35 -38
  134. data/ext/isomorfeus_ferret_ext/frt_q_filtered_query.c +53 -72
  135. data/ext/isomorfeus_ferret_ext/frt_q_fuzzy.c +25 -32
  136. data/ext/isomorfeus_ferret_ext/frt_q_match_all.c +21 -23
  137. data/ext/isomorfeus_ferret_ext/frt_q_multi_term.c +66 -103
  138. data/ext/isomorfeus_ferret_ext/frt_q_parser.c +207 -195
  139. data/ext/isomorfeus_ferret_ext/frt_q_phrase.c +20 -16
  140. data/ext/isomorfeus_ferret_ext/frt_q_prefix.c +17 -14
  141. data/ext/isomorfeus_ferret_ext/frt_q_range.c +102 -131
  142. data/ext/isomorfeus_ferret_ext/frt_q_span.c +179 -178
  143. data/ext/isomorfeus_ferret_ext/frt_q_term.c +47 -60
  144. data/ext/isomorfeus_ferret_ext/frt_q_wildcard.c +18 -16
  145. data/ext/isomorfeus_ferret_ext/frt_ram_store.c +46 -84
  146. data/ext/isomorfeus_ferret_ext/frt_search.c +105 -146
  147. data/ext/isomorfeus_ferret_ext/frt_search.h +331 -320
  148. data/ext/isomorfeus_ferret_ext/frt_similarity.c +5 -13
  149. data/ext/isomorfeus_ferret_ext/frt_similarity.h +7 -12
  150. data/ext/isomorfeus_ferret_ext/frt_sort.c +105 -149
  151. data/ext/isomorfeus_ferret_ext/frt_store.c +13 -7
  152. data/ext/isomorfeus_ferret_ext/frt_store.h +10 -2
  153. data/ext/isomorfeus_ferret_ext/frt_threading.h +0 -1
  154. data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.c +22 -112
  155. data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.h +2 -32
  156. data/ext/isomorfeus_ferret_ext/lz4.c +2495 -0
  157. data/ext/isomorfeus_ferret_ext/lz4.h +774 -0
  158. data/ext/isomorfeus_ferret_ext/lz4frame.c +1899 -0
  159. data/ext/isomorfeus_ferret_ext/lz4frame.h +623 -0
  160. data/ext/isomorfeus_ferret_ext/lz4hc.c +1615 -0
  161. data/ext/isomorfeus_ferret_ext/lz4hc.h +413 -0
  162. data/ext/isomorfeus_ferret_ext/lz4xxhash.c +1030 -0
  163. data/ext/isomorfeus_ferret_ext/lz4xxhash.h +328 -0
  164. data/ext/isomorfeus_ferret_ext/stem_modules.h +0 -86
  165. data/ext/isomorfeus_ferret_ext/test.c +0 -17
  166. data/ext/isomorfeus_ferret_ext/test_1710.c +11 -12
  167. data/ext/isomorfeus_ferret_ext/test_analysis.c +590 -583
  168. data/ext/isomorfeus_ferret_ext/test_compound_io.c +1 -1
  169. data/ext/isomorfeus_ferret_ext/test_document.c +19 -15
  170. data/ext/isomorfeus_ferret_ext/test_except.c +1 -2
  171. data/ext/isomorfeus_ferret_ext/test_fields.c +111 -100
  172. data/ext/isomorfeus_ferret_ext/test_file_deleter.c +10 -27
  173. data/ext/isomorfeus_ferret_ext/test_filter.c +11 -8
  174. data/ext/isomorfeus_ferret_ext/test_global.c +0 -46
  175. data/ext/isomorfeus_ferret_ext/test_hash.c +2 -2
  176. data/ext/isomorfeus_ferret_ext/test_hashset.c +1 -1
  177. data/ext/isomorfeus_ferret_ext/test_highlighter.c +15 -11
  178. data/ext/isomorfeus_ferret_ext/test_index.c +373 -363
  179. data/ext/isomorfeus_ferret_ext/test_q_const_score.c +5 -3
  180. data/ext/isomorfeus_ferret_ext/test_q_filtered.c +5 -3
  181. data/ext/isomorfeus_ferret_ext/test_q_fuzzy.c +13 -10
  182. data/ext/isomorfeus_ferret_ext/test_q_parser.c +45 -7
  183. data/ext/isomorfeus_ferret_ext/test_q_span.c +15 -12
  184. data/ext/isomorfeus_ferret_ext/test_ram_store.c +3 -3
  185. data/ext/isomorfeus_ferret_ext/test_search.c +60 -64
  186. data/ext/isomorfeus_ferret_ext/test_segments.c +5 -4
  187. data/ext/isomorfeus_ferret_ext/test_sort.c +17 -14
  188. data/ext/isomorfeus_ferret_ext/test_store.c +2 -0
  189. data/ext/isomorfeus_ferret_ext/test_term.c +3 -1
  190. data/ext/isomorfeus_ferret_ext/test_term_vectors.c +9 -10
  191. data/ext/isomorfeus_ferret_ext/test_test.c +1 -2
  192. data/ext/isomorfeus_ferret_ext/test_threading.c +9 -10
  193. data/ext/isomorfeus_ferret_ext/testhelper.c +1 -2
  194. data/lib/isomorfeus/ferret/version.rb +1 -1
  195. metadata +113 -58
  196. data/ext/isomorfeus_ferret_ext/email.rl +0 -21
  197. data/ext/isomorfeus_ferret_ext/frt_scanner.c +0 -900
  198. data/ext/isomorfeus_ferret_ext/frt_scanner.h +0 -28
  199. data/ext/isomorfeus_ferret_ext/frt_scanner_mb.c +0 -6706
  200. data/ext/isomorfeus_ferret_ext/frt_scanner_utf8.c +0 -4420
  201. data/ext/isomorfeus_ferret_ext/scanner.h +0 -28
  202. data/ext/isomorfeus_ferret_ext/scanner.in +0 -43
  203. data/ext/isomorfeus_ferret_ext/scanner.rl +0 -84
  204. data/ext/isomorfeus_ferret_ext/scanner_mb.rl +0 -200
  205. data/ext/isomorfeus_ferret_ext/scanner_utf8.rl +0 -85
  206. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_basque.c +0 -1167
  207. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_basque.h +0 -6
  208. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_catalan.c +0 -1433
  209. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_catalan.h +0 -6
  210. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_danish.c +0 -301
  211. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_danish.h +0 -6
  212. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_dutch.c +0 -590
  213. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_dutch.h +0 -6
  214. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_english.c +0 -1049
  215. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_english.h +0 -6
  216. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_finnish.c +0 -705
  217. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_finnish.h +0 -6
  218. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_french.c +0 -1239
  219. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_french.h +0 -6
  220. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_german.c +0 -477
  221. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_german.h +0 -6
  222. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_hungarian.c +0 -1217
  223. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_hungarian.h +0 -7
  224. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_indonesian.c +0 -394
  225. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_indonesian.h +0 -6
  226. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_irish.c +0 -457
  227. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_irish.h +0 -6
  228. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_italian.c +0 -1009
  229. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_italian.h +0 -6
  230. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_norwegian.c +0 -259
  231. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_norwegian.h +0 -6
  232. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_porter.c +0 -704
  233. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_porter.h +0 -6
  234. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_portuguese.c +0 -948
  235. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_portuguese.h +0 -6
  236. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_spanish.c +0 -1028
  237. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_spanish.h +0 -6
  238. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_swedish.c +0 -275
  239. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_swedish.h +0 -6
  240. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_hungarian.c +0 -849
  241. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_hungarian.h +0 -6
  242. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_romanian.c +0 -952
  243. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_romanian.h +0 -6
  244. data/ext/isomorfeus_ferret_ext/stem_KOI8_R_russian.c +0 -669
  245. data/ext/isomorfeus_ferret_ext/stem_KOI8_R_russian.h +0 -6
  246. data/ext/isomorfeus_ferret_ext/stem_modules.txt +0 -63
  247. data/ext/isomorfeus_ferret_ext/uchar-ucs4.rl +0 -1854
  248. data/ext/isomorfeus_ferret_ext/uchar-utf8.rl +0 -1999
  249. 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.6'
3
+ VERSION = '0.13.1'
4
4
  end
5
5
  end