isomorfeus-ferret 0.12.5 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +101 -19
- data/README.md +54 -4
- data/ext/isomorfeus_ferret_ext/bm_bitvector.c +22 -30
- data/ext/isomorfeus_ferret_ext/bm_hash.c +6 -12
- data/ext/isomorfeus_ferret_ext/bm_micro_string.c +3 -6
- data/ext/isomorfeus_ferret_ext/bm_store.c +11 -22
- data/ext/isomorfeus_ferret_ext/brotli_common_constants.c +15 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_constants.h +200 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_context.c +156 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_context.h +113 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_dictionary.c +5914 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_dictionary.h +64 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_platform.c +22 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_platform.h +594 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_transform.c +291 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_transform.h +85 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_version.h +26 -0
- data/ext/isomorfeus_ferret_ext/brotli_dec_bit_reader.c +76 -0
- data/ext/isomorfeus_ferret_ext/brotli_dec_bit_reader.h +351 -0
- data/ext/isomorfeus_ferret_ext/brotli_dec_decode.c +2608 -0
- data/ext/isomorfeus_ferret_ext/brotli_dec_huffman.c +339 -0
- data/ext/isomorfeus_ferret_ext/brotli_dec_huffman.h +121 -0
- data/ext/isomorfeus_ferret_ext/brotli_dec_prefix.h +732 -0
- data/ext/isomorfeus_ferret_ext/brotli_dec_state.c +159 -0
- data/ext/isomorfeus_ferret_ext/brotli_dec_state.h +365 -0
- data/ext/isomorfeus_ferret_ext/brotli_decode.h +344 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references.c +145 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references.h +39 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references_hq.c +843 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references_hq.h +95 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references_inc.h +163 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_bit_cost.c +35 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_bit_cost.h +63 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_bit_cost_inc.h +127 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_block_encoder_inc.h +34 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_block_splitter.c +194 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_block_splitter.h +51 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_block_splitter_inc.h +440 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_brotli_bit_stream.c +1314 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_brotli_bit_stream.h +84 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_cluster.c +56 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_cluster.h +48 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_cluster_inc.h +320 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_command.c +28 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_command.h +190 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_compress_fragment.c +790 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_compress_fragment.h +61 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_compress_fragment_two_pass.c +645 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_compress_fragment_two_pass.h +54 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_dictionary_hash.c +1846 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_dictionary_hash.h +25 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_encode.c +1927 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_encoder_dict.c +33 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_encoder_dict.h +43 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_entropy_encode.c +503 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_entropy_encode.h +122 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_entropy_encode_static.h +539 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_fast_log.c +105 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_fast_log.h +66 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_find_match_length.h +79 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_hash.h +488 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_hash_composite_inc.h +125 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_hash_forgetful_chain_inc.h +293 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_hash_longest_match64_inc.h +267 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_hash_longest_match_inc.h +262 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_hash_longest_match_quickly_inc.h +266 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_hash_rolling_inc.h +212 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_hash_to_binary_tree_inc.h +329 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_histogram.c +100 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_histogram.h +63 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_histogram_inc.h +51 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_literal_cost.c +175 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_literal_cost.h +30 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_memory.c +170 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_memory.h +114 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_metablock.c +663 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_metablock.h +105 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_metablock_inc.h +183 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_params.h +46 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_prefix.h +53 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_quality.h +165 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_ringbuffer.h +167 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_static_dict.c +486 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_static_dict.h +40 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_static_dict_lut.h +5864 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_utf8_util.c +85 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_utf8_util.h +32 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_write_bits.h +87 -0
- data/ext/isomorfeus_ferret_ext/brotli_encode.h +448 -0
- data/ext/isomorfeus_ferret_ext/brotli_port.h +288 -0
- data/ext/isomorfeus_ferret_ext/brotli_types.h +83 -0
- data/ext/isomorfeus_ferret_ext/bzip_blocksort.c +1094 -0
- data/ext/isomorfeus_ferret_ext/bzip_huffman.c +205 -0
- data/ext/isomorfeus_ferret_ext/bzlib.c +1572 -0
- data/ext/isomorfeus_ferret_ext/bzlib.h +282 -0
- data/ext/isomorfeus_ferret_ext/bzlib_compress.c +672 -0
- data/ext/isomorfeus_ferret_ext/bzlib_crctable.c +104 -0
- data/ext/isomorfeus_ferret_ext/bzlib_decompress.c +652 -0
- data/ext/isomorfeus_ferret_ext/bzlib_private.h +509 -0
- data/ext/isomorfeus_ferret_ext/bzlib_randtable.c +84 -0
- data/ext/isomorfeus_ferret_ext/fio_tmpfile.h +53 -53
- data/ext/isomorfeus_ferret_ext/frb_analysis.c +785 -1192
- data/ext/isomorfeus_ferret_ext/frb_index.c +513 -464
- data/ext/isomorfeus_ferret_ext/frb_qparser.c +48 -60
- data/ext/isomorfeus_ferret_ext/frb_search.c +1520 -1002
- data/ext/isomorfeus_ferret_ext/frb_store.c +96 -96
- data/ext/isomorfeus_ferret_ext/frb_threading.h +0 -1
- data/ext/isomorfeus_ferret_ext/frb_utils.c +147 -196
- data/ext/isomorfeus_ferret_ext/frt_analysis.c +695 -1090
- data/ext/isomorfeus_ferret_ext/frt_analysis.h +174 -170
- data/ext/isomorfeus_ferret_ext/frt_array.c +2 -4
- data/ext/isomorfeus_ferret_ext/frt_bitvector.c +9 -16
- data/ext/isomorfeus_ferret_ext/frt_bitvector.h +32 -81
- data/ext/isomorfeus_ferret_ext/frt_document.c +15 -20
- data/ext/isomorfeus_ferret_ext/frt_document.h +10 -9
- data/ext/isomorfeus_ferret_ext/frt_except.c +5 -12
- data/ext/isomorfeus_ferret_ext/frt_field_index.c +3 -3
- data/ext/isomorfeus_ferret_ext/frt_field_index.h +6 -7
- data/ext/isomorfeus_ferret_ext/frt_filter.c +35 -46
- data/ext/isomorfeus_ferret_ext/frt_fs_store.c +2 -0
- data/ext/isomorfeus_ferret_ext/frt_global.c +105 -63
- data/ext/isomorfeus_ferret_ext/frt_global.h +7 -3
- data/ext/isomorfeus_ferret_ext/frt_hash.c +1 -2
- data/ext/isomorfeus_ferret_ext/frt_ind.c +32 -35
- data/ext/isomorfeus_ferret_ext/frt_ind.h +9 -9
- data/ext/isomorfeus_ferret_ext/frt_index.c +714 -384
- data/ext/isomorfeus_ferret_ext/frt_index.h +274 -290
- data/ext/isomorfeus_ferret_ext/frt_mempool.c +1 -2
- data/ext/isomorfeus_ferret_ext/frt_multimapper.c +4 -7
- data/ext/isomorfeus_ferret_ext/frt_q_boolean.c +67 -91
- data/ext/isomorfeus_ferret_ext/frt_q_const_score.c +35 -38
- data/ext/isomorfeus_ferret_ext/frt_q_filtered_query.c +53 -72
- data/ext/isomorfeus_ferret_ext/frt_q_fuzzy.c +25 -32
- data/ext/isomorfeus_ferret_ext/frt_q_match_all.c +21 -23
- data/ext/isomorfeus_ferret_ext/frt_q_multi_term.c +66 -103
- data/ext/isomorfeus_ferret_ext/frt_q_parser.c +207 -195
- data/ext/isomorfeus_ferret_ext/frt_q_phrase.c +26 -25
- data/ext/isomorfeus_ferret_ext/frt_q_prefix.c +17 -14
- data/ext/isomorfeus_ferret_ext/frt_q_range.c +102 -131
- data/ext/isomorfeus_ferret_ext/frt_q_span.c +179 -178
- data/ext/isomorfeus_ferret_ext/frt_q_term.c +47 -60
- data/ext/isomorfeus_ferret_ext/frt_q_wildcard.c +18 -16
- data/ext/isomorfeus_ferret_ext/frt_ram_store.c +46 -84
- data/ext/isomorfeus_ferret_ext/frt_search.c +105 -146
- data/ext/isomorfeus_ferret_ext/frt_search.h +331 -320
- data/ext/isomorfeus_ferret_ext/frt_similarity.c +5 -13
- data/ext/isomorfeus_ferret_ext/frt_similarity.h +7 -12
- data/ext/isomorfeus_ferret_ext/frt_sort.c +105 -149
- data/ext/isomorfeus_ferret_ext/frt_store.c +13 -7
- data/ext/isomorfeus_ferret_ext/frt_store.h +10 -2
- data/ext/isomorfeus_ferret_ext/frt_threading.h +0 -1
- data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.c +21 -109
- data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.h +2 -32
- data/ext/isomorfeus_ferret_ext/lz4.c +2495 -0
- data/ext/isomorfeus_ferret_ext/lz4.h +774 -0
- data/ext/isomorfeus_ferret_ext/lz4frame.c +1899 -0
- data/ext/isomorfeus_ferret_ext/lz4frame.h +623 -0
- data/ext/isomorfeus_ferret_ext/lz4hc.c +1615 -0
- data/ext/isomorfeus_ferret_ext/lz4hc.h +413 -0
- data/ext/isomorfeus_ferret_ext/lz4xxhash.c +1030 -0
- data/ext/isomorfeus_ferret_ext/lz4xxhash.h +328 -0
- data/ext/isomorfeus_ferret_ext/stem_modules.h +0 -86
- data/ext/isomorfeus_ferret_ext/test.c +1 -2
- data/ext/isomorfeus_ferret_ext/test_1710.c +11 -12
- data/ext/isomorfeus_ferret_ext/test_analysis.c +590 -583
- data/ext/isomorfeus_ferret_ext/test_compound_io.c +1 -1
- data/ext/isomorfeus_ferret_ext/test_document.c +19 -15
- data/ext/isomorfeus_ferret_ext/test_except.c +1 -2
- data/ext/isomorfeus_ferret_ext/test_fields.c +111 -100
- data/ext/isomorfeus_ferret_ext/test_file_deleter.c +10 -27
- data/ext/isomorfeus_ferret_ext/test_filter.c +11 -8
- data/ext/isomorfeus_ferret_ext/test_hash.c +2 -2
- data/ext/isomorfeus_ferret_ext/test_hashset.c +1 -1
- data/ext/isomorfeus_ferret_ext/test_highlighter.c +15 -11
- data/ext/isomorfeus_ferret_ext/test_index.c +373 -363
- data/ext/isomorfeus_ferret_ext/test_q_const_score.c +5 -3
- data/ext/isomorfeus_ferret_ext/test_q_filtered.c +5 -3
- data/ext/isomorfeus_ferret_ext/test_q_fuzzy.c +13 -10
- data/ext/isomorfeus_ferret_ext/test_q_parser.c +45 -7
- data/ext/isomorfeus_ferret_ext/test_q_span.c +15 -12
- data/ext/isomorfeus_ferret_ext/test_ram_store.c +3 -3
- data/ext/isomorfeus_ferret_ext/test_search.c +60 -62
- data/ext/isomorfeus_ferret_ext/test_segments.c +5 -4
- data/ext/isomorfeus_ferret_ext/test_sort.c +17 -14
- data/ext/isomorfeus_ferret_ext/test_store.c +2 -0
- data/ext/isomorfeus_ferret_ext/test_term.c +3 -1
- data/ext/isomorfeus_ferret_ext/test_term_vectors.c +9 -10
- data/ext/isomorfeus_ferret_ext/test_test.c +1 -2
- data/ext/isomorfeus_ferret_ext/test_threading.c +9 -10
- data/ext/isomorfeus_ferret_ext/testhelper.c +1 -2
- data/lib/isomorfeus/ferret/version.rb +1 -1
- metadata +113 -58
- data/ext/isomorfeus_ferret_ext/email.rl +0 -21
- data/ext/isomorfeus_ferret_ext/frt_scanner.c +0 -900
- data/ext/isomorfeus_ferret_ext/frt_scanner.h +0 -28
- data/ext/isomorfeus_ferret_ext/frt_scanner_mb.c +0 -6706
- data/ext/isomorfeus_ferret_ext/frt_scanner_utf8.c +0 -4420
- data/ext/isomorfeus_ferret_ext/scanner.h +0 -28
- data/ext/isomorfeus_ferret_ext/scanner.in +0 -43
- data/ext/isomorfeus_ferret_ext/scanner.rl +0 -84
- data/ext/isomorfeus_ferret_ext/scanner_mb.rl +0 -200
- data/ext/isomorfeus_ferret_ext/scanner_utf8.rl +0 -85
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_basque.c +0 -1167
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_basque.h +0 -6
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_catalan.c +0 -1433
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_catalan.h +0 -6
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_danish.c +0 -301
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_danish.h +0 -6
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_dutch.c +0 -590
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_dutch.h +0 -6
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_english.c +0 -1049
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_english.h +0 -6
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_finnish.c +0 -705
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_finnish.h +0 -6
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_french.c +0 -1239
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_french.h +0 -6
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_german.c +0 -477
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_german.h +0 -6
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_hungarian.c +0 -1217
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_hungarian.h +0 -7
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_indonesian.c +0 -394
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_indonesian.h +0 -6
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_irish.c +0 -457
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_irish.h +0 -6
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_italian.c +0 -1009
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_italian.h +0 -6
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_norwegian.c +0 -259
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_norwegian.h +0 -6
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_porter.c +0 -704
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_porter.h +0 -6
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_portuguese.c +0 -948
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_portuguese.h +0 -6
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_spanish.c +0 -1028
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_spanish.h +0 -6
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_swedish.c +0 -275
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_swedish.h +0 -6
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_hungarian.c +0 -849
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_hungarian.h +0 -6
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_romanian.c +0 -952
- data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_romanian.h +0 -6
- data/ext/isomorfeus_ferret_ext/stem_KOI8_R_russian.c +0 -669
- data/ext/isomorfeus_ferret_ext/stem_KOI8_R_russian.h +0 -6
- data/ext/isomorfeus_ferret_ext/stem_modules.txt +0 -63
- data/ext/isomorfeus_ferret_ext/uchar-ucs4.rl +0 -1854
- data/ext/isomorfeus_ferret_ext/uchar-utf8.rl +0 -1999
- data/ext/isomorfeus_ferret_ext/url.rl +0 -27
@@ -2,37 +2,37 @@
|
|
2
2
|
#include "frt_array.h"
|
3
3
|
#include <string.h>
|
4
4
|
|
5
|
+
#undef close
|
6
|
+
|
5
7
|
static const char *NON_UNIQUE_KEY_ERROR_MSG =
|
6
8
|
"Tried to use a key that was not unique";
|
7
9
|
|
8
|
-
#define INDEX_CLOSE_READER(self) do {
|
9
|
-
if (self->sea) {
|
10
|
-
frt_searcher_close(self->sea);
|
11
|
-
self->sea = NULL;
|
12
|
-
self->ir = NULL;
|
13
|
-
} else if (self->ir) {
|
14
|
-
frt_ir_close(self->ir);
|
15
|
-
self->ir = NULL;
|
16
|
-
}
|
10
|
+
#define INDEX_CLOSE_READER(self) do { \
|
11
|
+
if (self->sea) { \
|
12
|
+
frt_searcher_close(self->sea); \
|
13
|
+
self->sea = NULL; \
|
14
|
+
self->ir = NULL; \
|
15
|
+
} else if (self->ir) { \
|
16
|
+
frt_ir_close(self->ir); \
|
17
|
+
self->ir = NULL; \
|
18
|
+
} \
|
17
19
|
} while (0)
|
18
20
|
|
19
|
-
#define AUTOFLUSH_IR(self) do {
|
21
|
+
#define AUTOFLUSH_IR(self) do { \
|
20
22
|
if (self->auto_flush) frt_ir_commit(self->ir); \
|
21
|
-
else self->has_writes = true;
|
23
|
+
else self->has_writes = true; \
|
22
24
|
} while(0)
|
23
25
|
|
24
26
|
#define AUTOFLUSH_IW(self) do { \
|
25
27
|
if (self->auto_flush) { \
|
26
|
-
frt_iw_close(self->iw);
|
28
|
+
frt_iw_close(self->iw); \
|
27
29
|
self->iw = NULL; \
|
28
30
|
} else { \
|
29
31
|
self->has_writes = true; \
|
30
32
|
} \
|
31
33
|
} while (0)
|
32
34
|
|
33
|
-
FrtIndex *frt_index_new(FrtStore *store, FrtAnalyzer *analyzer, FrtHashSet *def_fields,
|
34
|
-
bool create)
|
35
|
-
{
|
35
|
+
FrtIndex *frt_index_new(FrtStore *store, FrtAnalyzer *analyzer, FrtHashSet *def_fields, bool create) {
|
36
36
|
FrtIndex *self = FRT_ALLOC_AND_ZERO(FrtIndex);
|
37
37
|
FrtHashSetEntry *hse;
|
38
38
|
/* FIXME: need to add these to the query parser */
|
@@ -43,18 +43,18 @@ FrtIndex *frt_index_new(FrtStore *store, FrtAnalyzer *analyzer, FrtHashSet *def_
|
|
43
43
|
FRT_REF(store);
|
44
44
|
self->store = store;
|
45
45
|
} else {
|
46
|
-
self->store = frt_open_ram_store();
|
46
|
+
self->store = frt_open_ram_store(NULL);
|
47
47
|
create = true;
|
48
48
|
}
|
49
49
|
if (analyzer) {
|
50
50
|
self->analyzer = analyzer;
|
51
51
|
FRT_REF(analyzer);
|
52
52
|
} else {
|
53
|
-
self->analyzer =
|
53
|
+
self->analyzer = frt_standard_analyzer_new(true);
|
54
54
|
}
|
55
55
|
|
56
56
|
if (create) {
|
57
|
-
FrtFieldInfos *fis = frt_fis_new(FRT_STORE_YES, FRT_INDEX_YES, FRT_TERM_VECTOR_WITH_POSITIONS_OFFSETS);
|
57
|
+
FrtFieldInfos *fis = frt_fis_new(FRT_STORE_YES, FRT_COMPRESSION_NONE, FRT_INDEX_YES, FRT_TERM_VECTOR_WITH_POSITIONS_OFFSETS);
|
58
58
|
frt_index_create(self->store, fis);
|
59
59
|
frt_fis_deref(fis);
|
60
60
|
}
|
@@ -69,7 +69,7 @@ FrtIndex *frt_index_new(FrtStore *store, FrtAnalyzer *analyzer, FrtHashSet *def_
|
|
69
69
|
FRT_REF(self->analyzer);
|
70
70
|
self->qp = frt_qp_new(self->analyzer);
|
71
71
|
for (hse = def_fields->first; hse; hse = hse->next) {
|
72
|
-
frt_qp_add_field(self->qp, (
|
72
|
+
frt_qp_add_field(self->qp, (ID)hse->elem, true, true);
|
73
73
|
}
|
74
74
|
/* Index is a convenience class so set qp convenience options */
|
75
75
|
self->qp->allow_any_fields = true;
|
@@ -99,7 +99,7 @@ void frt_ensure_writer_open(FrtIndex *self)
|
|
99
99
|
|
100
100
|
/* make sure the analzyer isn't deleted by the FrtIndexWriter */
|
101
101
|
FRT_REF(self->analyzer);
|
102
|
-
self->iw = frt_iw_open(self->store, self->analyzer, false);
|
102
|
+
self->iw = frt_iw_open(NULL, self->store, self->analyzer, false);
|
103
103
|
self->iw->config.use_compound_file = self->config.use_compound_file;
|
104
104
|
}
|
105
105
|
}
|
@@ -109,7 +109,7 @@ void frt_ensure_reader_open(FrtIndex *self)
|
|
109
109
|
if (self->ir) {
|
110
110
|
if (self->check_latest && !frt_ir_is_latest(self->ir)) {
|
111
111
|
INDEX_CLOSE_READER(self);
|
112
|
-
self->ir = frt_ir_open(self->store);
|
112
|
+
self->ir = frt_ir_open(NULL, self->store);
|
113
113
|
}
|
114
114
|
return;
|
115
115
|
}
|
@@ -117,7 +117,7 @@ void frt_ensure_reader_open(FrtIndex *self)
|
|
117
117
|
frt_iw_close(self->iw);
|
118
118
|
self->iw = NULL;
|
119
119
|
}
|
120
|
-
self->ir = frt_ir_open(self->store);
|
120
|
+
self->ir = frt_ir_open(NULL, self->store);
|
121
121
|
}
|
122
122
|
|
123
123
|
void frt_ensure_searcher_open(FrtIndex *self)
|
@@ -172,7 +172,7 @@ static void index_del_doc_with_key_i(FrtIndex *self, FrtDocument *doc,
|
|
172
172
|
FrtHashSetEntry *hse;
|
173
173
|
|
174
174
|
if (key->size == 1) {
|
175
|
-
|
175
|
+
ID field = (ID)key->first->elem;
|
176
176
|
frt_ensure_writer_open(self);
|
177
177
|
df = frt_doc_get_field(doc, field);
|
178
178
|
if (df) {
|
@@ -185,7 +185,7 @@ static void index_del_doc_with_key_i(FrtIndex *self, FrtDocument *doc,
|
|
185
185
|
frt_ensure_searcher_open(self);
|
186
186
|
|
187
187
|
for (hse = key->first; hse; hse = hse->next) {
|
188
|
-
|
188
|
+
ID field = (ID)hse->elem;
|
189
189
|
df = frt_doc_get_field(doc, field);
|
190
190
|
if (!df) continue;
|
191
191
|
frt_bq_add_query(q, frt_tq_new(field, df->data[0]), FRT_BC_MUST);
|
@@ -220,7 +220,7 @@ void frt_index_add_doc(FrtIndex *self, FrtDocument *doc)
|
|
220
220
|
frt_mutex_unlock(&self->mutex);
|
221
221
|
}
|
222
222
|
|
223
|
-
FrtQuery *frt_index_get_query(FrtIndex *self, char *qstr)
|
223
|
+
FrtQuery *frt_index_get_query(FrtIndex *self, char *qstr, rb_encoding *encoding)
|
224
224
|
{
|
225
225
|
int i;
|
226
226
|
FrtFieldInfos *fis;
|
@@ -229,16 +229,16 @@ FrtQuery *frt_index_get_query(FrtIndex *self, char *qstr)
|
|
229
229
|
for (i = fis->size - 1; i >= 0; i--) {
|
230
230
|
frt_hs_add(self->qp->all_fields, (void *)fis->fields[i]->name);
|
231
231
|
}
|
232
|
-
return qp_parse(self->qp, qstr);
|
232
|
+
return qp_parse(self->qp, qstr, encoding);
|
233
233
|
}
|
234
234
|
|
235
235
|
FrtTopDocs *frt_index_search_str(FrtIndex *self, char *qstr, int first_doc,
|
236
236
|
int num_docs, FrtFilter *filter, FrtSort *sort,
|
237
|
-
FrtPostFilter *post_filter)
|
237
|
+
FrtPostFilter *post_filter, rb_encoding *encoding)
|
238
238
|
{
|
239
239
|
FrtQuery *query;
|
240
240
|
FrtTopDocs *td;
|
241
|
-
query = frt_index_get_query(self, qstr); /* will ensure_searcher is open */
|
241
|
+
query = frt_index_get_query(self, qstr, encoding); /* will ensure_searcher is open */
|
242
242
|
td = frt_searcher_search(self->sea, query, first_doc, num_docs,
|
243
243
|
filter, sort, post_filter);
|
244
244
|
frt_q_deref(query);
|
@@ -264,9 +264,7 @@ FrtDocument *frt_index_get_doc_ts(FrtIndex *self, int doc_num)
|
|
264
264
|
return doc;
|
265
265
|
}
|
266
266
|
|
267
|
-
FrtDocument *frt_index_get_doc_term(FrtIndex *self,
|
268
|
-
const char *term)
|
269
|
-
{
|
267
|
+
FrtDocument *frt_index_get_doc_term(FrtIndex *self, ID field, const char *term) {
|
270
268
|
FrtDocument *doc = NULL;
|
271
269
|
FrtTermDocEnum *tde;
|
272
270
|
frt_mutex_lock(&self->mutex);
|
@@ -298,8 +296,7 @@ void frt_index_delete(FrtIndex *self, int doc_num)
|
|
298
296
|
frt_mutex_unlock(&self->mutex);
|
299
297
|
}
|
300
298
|
|
301
|
-
void frt_index_delete_term(FrtIndex *self,
|
302
|
-
{
|
299
|
+
void frt_index_delete_term(FrtIndex *self, ID field, const char *term) {
|
303
300
|
FrtTermDocEnum *tde;
|
304
301
|
frt_mutex_lock(&self->mutex);
|
305
302
|
{
|
@@ -345,9 +342,9 @@ void frt_index_delete_query(FrtIndex *self, FrtQuery *q, FrtFilter *f,
|
|
345
342
|
}
|
346
343
|
|
347
344
|
void frt_index_delete_query_str(FrtIndex *self, char *qstr, FrtFilter *f,
|
348
|
-
FrtPostFilter *post_filter)
|
345
|
+
FrtPostFilter *post_filter, rb_encoding *encoding)
|
349
346
|
{
|
350
|
-
FrtQuery *q = frt_index_get_query(self, qstr);
|
347
|
+
FrtQuery *q = frt_index_get_query(self, qstr, encoding);
|
351
348
|
frt_index_delete_query(self, q, f, post_filter);
|
352
349
|
frt_q_deref(q);
|
353
350
|
}
|
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
#include "frt_search.h"
|
5
5
|
#include "frt_index.h"
|
6
|
+
#include <ruby/encoding.h>
|
6
7
|
|
7
8
|
/***************************************************************************
|
8
9
|
*
|
@@ -10,8 +11,7 @@
|
|
10
11
|
*
|
11
12
|
***************************************************************************/
|
12
13
|
|
13
|
-
typedef struct FrtIndex
|
14
|
-
{
|
14
|
+
typedef struct FrtIndex {
|
15
15
|
FrtConfig config;
|
16
16
|
frt_mutex_t mutex;
|
17
17
|
FrtStore *store;
|
@@ -21,8 +21,8 @@ typedef struct FrtIndex
|
|
21
21
|
FrtSearcher *sea;
|
22
22
|
FrtQParser *qp;
|
23
23
|
FrtHashSet *key;
|
24
|
-
|
25
|
-
|
24
|
+
ID id_field;
|
25
|
+
ID def_field;
|
26
26
|
/* for FrtIndexWriter */
|
27
27
|
bool auto_flush : 1;
|
28
28
|
bool has_writes : 1;
|
@@ -35,17 +35,17 @@ extern int frt_index_size(FrtIndex *self);
|
|
35
35
|
extern void frt_index_optimize(FrtIndex *self);
|
36
36
|
extern bool frt_index_is_deleted(FrtIndex *self, int doc_num);
|
37
37
|
extern void frt_index_add_doc(FrtIndex *self, FrtDocument *doc);
|
38
|
-
extern FrtTopDocs *frt_index_search_str(FrtIndex *self, char *query, int first_doc, int num_docs, FrtFilter *filter, FrtSort *sort, FrtPostFilter *post_filter);
|
39
|
-
extern FrtQuery *frt_index_get_query(FrtIndex *self, char *qstr);
|
38
|
+
extern FrtTopDocs *frt_index_search_str(FrtIndex *self, char *query, int first_doc, int num_docs, FrtFilter *filter, FrtSort *sort, FrtPostFilter *post_filter, rb_encoding *encoding);
|
39
|
+
extern FrtQuery *frt_index_get_query(FrtIndex *self, char *qstr, rb_encoding *encoding);
|
40
40
|
extern FrtDocument *frt_index_get_doc(FrtIndex *self, int doc_num);
|
41
41
|
extern FrtDocument *frt_index_get_doc_ts(FrtIndex *self, int doc_num);
|
42
42
|
extern FrtDocument *frt_index_get_doc_id(FrtIndex *self, const char *id);
|
43
|
-
extern FrtDocument *frt_index_get_doc_term(FrtIndex *self,
|
43
|
+
extern FrtDocument *frt_index_get_doc_term(FrtIndex *self, ID field, const char *term);
|
44
44
|
extern void frt_index_delete(FrtIndex *self, int doc_num);
|
45
|
-
extern void frt_index_delete_term(FrtIndex *self,
|
45
|
+
extern void frt_index_delete_term(FrtIndex *self, ID field, const char *term);
|
46
46
|
extern void frt_index_delete_id(FrtIndex *self, const char *id);
|
47
47
|
extern void frt_index_delete_query(FrtIndex *self, FrtQuery *q, FrtFilter *f, FrtPostFilter *pf);
|
48
|
-
extern void frt_index_delete_query_str(FrtIndex *self, char *qstr,FrtFilter *f, FrtPostFilter *pf);
|
48
|
+
extern void frt_index_delete_query_str(FrtIndex *self, char *qstr,FrtFilter *f, FrtPostFilter *pf, rb_encoding *encoding);
|
49
49
|
|
50
50
|
extern void frt_ensure_searcher_open(FrtIndex *self);
|
51
51
|
extern void frt_ensure_reader_open(FrtIndex *self);
|