isomorfeus-ferret 0.14.2 → 0.14.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9954cd3c9b84e7689861a8039c8305407b218d683f9cdfc74ee77542ae6f125c
4
- data.tar.gz: 8bcf947f08f84fa7c73e157caaa254a8e21e4700b0c852004613e8c9c9517716
3
+ metadata.gz: 2821c4f4967a8af0c4f6e00a4c256754b77da083fbe5dab47e0eeac705561f01
4
+ data.tar.gz: 79c06afc07045bbe7048fa0c570384d8ead0b8fe351dde4829a26e1a1b1bde73
5
5
  SHA512:
6
- metadata.gz: '083b7943b6d5d1dd59d114d5db4dba0d54f1684a7057ce6358b105ac9564908310bdd2df2539791ed30142428b4ec53ab646d2980eb8549998f2cb586b8c6892'
7
- data.tar.gz: e5e15c37ffa004850a18eacae06f95535b460522166a1bc4ec611d3a4dae0aaddb7180d06f78d479e397708a167a5372d093ad2173a026d5888a7c2d34b3aef0
6
+ metadata.gz: 8fc4e106796d397bdc359af7d7b42120c143cbd93e57a9cb71f1e0ca5e89f9856bc6897eb39e4358cfa0c97d77b104c6a818b4c5aaafaebdb0da2efbca00546a
7
+ data.tar.gz: 6002e45cd95bf3eb0f258ee209c783f4f4eb966068009cc76de35ad9b4a0f4a03a41180655d6d79d40a86151fe3e663b57ad79c604184eac134adfaa425153e8
@@ -13,7 +13,7 @@
13
13
 
14
14
  #define FRT_MAX_WORD_SIZE 255
15
15
  #define FRT_MAX_FILE_PATH 1024
16
- #define FRT_BUFFER_SIZE 16384
16
+ #define FRT_BUFFER_SIZE 4096
17
17
 
18
18
  typedef enum {
19
19
  FRT_COMPRESSION_NONE = 0,
@@ -2711,7 +2711,7 @@ void frt_tir_close(FrtTermInfosReader *tir) {
2711
2711
  *
2712
2712
  ****************************************************************************/
2713
2713
 
2714
- static FrtTermWriter *tw_new(FrtStore *store, char *file_name) {
2714
+ static FrtTermWriter *frt_tw_new(FrtStore *store, char *file_name) {
2715
2715
  FrtTermWriter *tw = FRT_ALLOC_AND_ZERO(FrtTermWriter);
2716
2716
  tw->os = store->new_output(store, file_name);
2717
2717
  tw->last_term = FRT_EMPTY_STRING;
@@ -2736,9 +2736,9 @@ FrtTermInfosWriter *frt_tiw_open(FrtStore *store, const char *segment, int index
2736
2736
  tiw->last_index_ptr = 0;
2737
2737
 
2738
2738
  strcpy(file_name + segment_len, ".tix");
2739
- tiw->tix_writer = tw_new(store, file_name);
2739
+ tiw->tix_writer = frt_tw_new(store, file_name);
2740
2740
  strcpy(file_name + segment_len, ".tis");
2741
- tiw->tis_writer = tw_new(store, file_name);
2741
+ tiw->tis_writer = frt_tw_new(store, file_name);
2742
2742
  strcpy(file_name + segment_len, ".tfx");
2743
2743
  tiw->tfx_out = store->new_output(store, file_name);
2744
2744
  frt_os_write_u32(tiw->tfx_out, 0); /* make space for field_count */
@@ -851,6 +851,34 @@ module Isomorfeus
851
851
  end
852
852
  end
853
853
 
854
+ # Exports the data of the stored fields as documents to a jsonl-formatted file
855
+ def export_to_jsonl(file_name)
856
+ count = 0
857
+ File.open(file_name, 'wt') do |f|
858
+ each do |doc|
859
+ json = Oj.dump(doc.to_h, mode: :strict)
860
+ f.write(json + "\n")
861
+ count += 1
862
+ end
863
+ end
864
+ count
865
+ end
866
+
867
+ # Imports documents from a jsonl-formatted file
868
+ def import_from_jsonl(file_name)
869
+ count = 0
870
+ File.open(file_name, 'rt') do |f|
871
+ f.each_line do |json|
872
+ unless json.empty?
873
+ doc = Oj.load(json, mode: :strict)
874
+ add_document(doc)
875
+ count += 1
876
+ end
877
+ end
878
+ end
879
+ count
880
+ end
881
+
854
882
  protected
855
883
  def ensure_writer_open()
856
884
  raise "tried to use a closed index" if not @open
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Ferret
3
- VERSION = '0.14.2'
3
+ VERSION = '0.14.3'
4
4
  end
5
5
  end
@@ -1,8 +1,9 @@
1
+ require 'monitor'
2
+ require 'oj'
1
3
  require 'isomorfeus_ferret_ext'
2
4
  require 'isomorfeus/ferret/version'
3
5
  require 'isomorfeus/ferret/field_symbol'
4
6
  require 'isomorfeus/ferret/stdlib_patches'
5
- require 'monitor'
6
7
  require 'isomorfeus/ferret/index/field_infos'
7
8
  require 'isomorfeus/ferret/index/index'
8
9
  require 'isomorfeus/ferret/document'
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-ferret
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.2
4
+ version: 0.14.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-06 00:00:00.000000000 Z
11
+ date: 2022-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
19
+ version: 3.13.14
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 3.13.14
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement