isomorfeus-ferret 0.17.1 → 0.17.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/isomorfeus_ferret_ext/bm_store.c +2 -0
- data/ext/isomorfeus_ferret_ext/frb_index.c +0 -35
- data/ext/isomorfeus_ferret_ext/frt_except.c +42 -0
- data/ext/isomorfeus_ferret_ext/frt_except.h +2 -0
- data/ext/isomorfeus_ferret_ext/frt_in_stream.c +492 -0
- data/ext/isomorfeus_ferret_ext/frt_in_stream.h +240 -0
- data/ext/isomorfeus_ferret_ext/frt_ind.c +0 -11
- data/ext/isomorfeus_ferret_ext/frt_ind.h +0 -1
- data/ext/isomorfeus_ferret_ext/frt_index.c +6 -1069
- data/ext/isomorfeus_ferret_ext/frt_index.h +1 -43
- data/ext/isomorfeus_ferret_ext/frt_lazy_doc.c +29 -0
- data/ext/isomorfeus_ferret_ext/frt_lazy_doc.h +19 -0
- data/ext/isomorfeus_ferret_ext/frt_lazy_doc_field.c +100 -0
- data/ext/isomorfeus_ferret_ext/frt_lazy_doc_field.h +33 -0
- data/ext/isomorfeus_ferret_ext/frt_out_stream.c +346 -0
- data/ext/isomorfeus_ferret_ext/frt_out_stream.h +198 -0
- data/ext/isomorfeus_ferret_ext/frt_ram_store.h +12 -0
- data/ext/isomorfeus_ferret_ext/frt_store.c +2 -513
- data/ext/isomorfeus_ferret_ext/frt_store.h +4 -443
- data/ext/isomorfeus_ferret_ext/frt_stream.h +18 -0
- data/ext/isomorfeus_ferret_ext/test_file_deleter.c +0 -1
- data/ext/isomorfeus_ferret_ext/test_index.c +0 -8
- data/ext/isomorfeus_ferret_ext/test_threading.c +1 -10
- data/lib/isomorfeus/ferret/index/index.rb +0 -11
- data/lib/isomorfeus/ferret/version.rb +1 -1
- metadata +22 -3
@@ -10,140 +10,16 @@
|
|
10
10
|
#define HAVE_STRUCT_IOVEC
|
11
11
|
#endif
|
12
12
|
#include "mdbx.h"
|
13
|
+
#include "frt_ram_store.h"
|
14
|
+
#include "frt_in_stream.h"
|
15
|
+
#include "frt_out_stream.h"
|
13
16
|
|
14
17
|
#define FRT_LOCK_PREFIX "ferret-"
|
15
18
|
#define FRT_LOCK_EXT ".lck"
|
16
19
|
|
17
|
-
typedef struct FrtBuffer {
|
18
|
-
frt_uchar buf[FRT_BUFFER_SIZE];
|
19
|
-
frt_off_t start;
|
20
|
-
frt_off_t pos;
|
21
|
-
frt_off_t len;
|
22
|
-
} FrtBuffer;
|
23
|
-
|
24
20
|
typedef struct FrtStore FrtStore;
|
25
|
-
typedef struct FrtOutStream FrtOutStream;
|
26
|
-
struct FrtOutStreamMethods {
|
27
|
-
/* internal functions for the FrtInStream */
|
28
|
-
/**
|
29
|
-
* Flush +len+ characters from +src+ to the output stream +os+
|
30
|
-
*
|
31
|
-
* @param os self
|
32
|
-
* @param src the characters to write to the output stream
|
33
|
-
* @param len the number of characters to write
|
34
|
-
* @raise FRT_IO_ERROR if there is an error writing the characters
|
35
|
-
*/
|
36
|
-
void (*flush_i)(struct FrtOutStream *os, const frt_uchar *buf, int len);
|
37
|
-
|
38
|
-
/**
|
39
|
-
* Seek +pos+ in the output stream
|
40
|
-
*
|
41
|
-
* @param os self
|
42
|
-
* @param pos the position to seek in the stream
|
43
|
-
* @raise FRT_IO_ERROR if there is an error seeking in the output stream
|
44
|
-
*/
|
45
|
-
void (*seek_i)(struct FrtOutStream *os, frt_off_t pos);
|
46
|
-
|
47
|
-
/**
|
48
|
-
* Close any resources used by the output stream +os+
|
49
|
-
*
|
50
|
-
* @param os self
|
51
|
-
* @raise FRT_IO_ERROR if there is an error closing the file
|
52
|
-
*/
|
53
|
-
void (*close_i)(struct FrtOutStream *os);
|
54
|
-
};
|
55
|
-
|
56
|
-
typedef struct FrtRAMFile {
|
57
|
-
char *name;
|
58
|
-
frt_uchar **buffers;
|
59
|
-
int bufcnt;
|
60
|
-
frt_off_t len;
|
61
|
-
_Atomic unsigned int ref_cnt;
|
62
|
-
} FrtRAMFile;
|
63
|
-
|
64
|
-
struct FrtOutStream {
|
65
|
-
FrtBuffer buf;
|
66
|
-
frt_off_t pointer; /* only used by RAMOut */
|
67
|
-
FrtStore *store;
|
68
|
-
union {
|
69
|
-
int fd;
|
70
|
-
FrtRAMFile *rf;
|
71
|
-
} file;
|
72
|
-
const struct FrtOutStreamMethods *m;
|
73
|
-
};
|
74
|
-
|
75
|
-
typedef struct FrtCompoundInStream FrtCompoundInStream;
|
76
|
-
|
77
|
-
typedef struct FrtInStream FrtInStream;
|
78
|
-
|
79
|
-
struct FrtInStreamMethods {
|
80
|
-
/**
|
81
|
-
* Read +len+ characters from the input stream into the +offset+ position in
|
82
|
-
* +buf+, an array of unsigned characters.
|
83
|
-
*
|
84
|
-
* @param is self
|
85
|
-
* @param buf an array of characters which must be allocated with at least
|
86
|
-
* +offset+ + +len+ bytes
|
87
|
-
* @param len the number of bytes to read
|
88
|
-
* @raise FRT_IO_ERROR if there is an error reading from the input stream
|
89
|
-
*/
|
90
|
-
void (*read_i)(struct FrtInStream *is, frt_uchar *buf, int len);
|
91
|
-
|
92
|
-
/**
|
93
|
-
* Seek position +pos+ in input stream +is+
|
94
|
-
*
|
95
|
-
* @param is self
|
96
|
-
* @param pos the position to seek
|
97
|
-
* @raise FRT_IO_ERROR if the seek fails
|
98
|
-
*/
|
99
|
-
void (*seek_i)(struct FrtInStream *is, frt_off_t pos);
|
100
|
-
|
101
|
-
/**
|
102
|
-
* Returns the length of the input stream +is+
|
103
|
-
*
|
104
|
-
* @param is self
|
105
|
-
* @raise FRT_IO_ERROR if there is an error getting the file length
|
106
|
-
*/
|
107
|
-
frt_off_t (*length_i)(struct FrtInStream *is);
|
108
|
-
|
109
|
-
/**
|
110
|
-
* Close the resources allocated to the inputstream +is+
|
111
|
-
*
|
112
|
-
* @param is self
|
113
|
-
* @raise FRT_IO_ERROR if the close fails
|
114
|
-
*/
|
115
|
-
void (*close_i)(struct FrtInStream *is);
|
116
|
-
};
|
117
|
-
|
118
|
-
typedef struct FrtInStreamFile {
|
119
|
-
_Atomic unsigned int ref_cnt;
|
120
|
-
union {
|
121
|
-
int fd;
|
122
|
-
FrtRAMFile *rf;
|
123
|
-
} file;
|
124
|
-
} FrtInStreamFile;
|
125
|
-
|
126
|
-
struct FrtInStream {
|
127
|
-
FrtBuffer buf;
|
128
|
-
struct FrtInStreamFile *f;
|
129
|
-
union {
|
130
|
-
frt_off_t pointer; /* only used by RAMIn */
|
131
|
-
char *path; /* only used by FSIn */
|
132
|
-
FrtCompoundInStream *cis;
|
133
|
-
} d;
|
134
|
-
_Atomic unsigned int ref_cnt;
|
135
|
-
const struct FrtInStreamMethods *m;
|
136
|
-
};
|
137
|
-
|
138
|
-
struct FrtCompoundInStream {
|
139
|
-
FrtInStream *sub;
|
140
|
-
frt_off_t offset;
|
141
|
-
frt_off_t length;
|
142
|
-
};
|
143
|
-
|
144
|
-
#define frt_is_length(mis) mis->m->length_i(mis)
|
145
|
-
|
146
21
|
typedef struct FrtLock FrtLock;
|
22
|
+
|
147
23
|
struct FrtLock {
|
148
24
|
char *name;
|
149
25
|
FrtStore *store;
|
@@ -153,13 +29,6 @@ struct FrtLock {
|
|
153
29
|
VALUE rlock;
|
154
30
|
};
|
155
31
|
|
156
|
-
typedef struct FrtCompoundStore {
|
157
|
-
FrtStore *store;
|
158
|
-
const char *name;
|
159
|
-
FrtHash *entries;
|
160
|
-
FrtInStream *stream;
|
161
|
-
} FrtCompoundStore;
|
162
|
-
|
163
32
|
typedef struct MDBXInfo {
|
164
33
|
MDBX_env *env;
|
165
34
|
char *path;
|
@@ -435,314 +304,6 @@ extern void frt_with_lock_name(FrtStore *store, const char *lock_name, void (*fu
|
|
435
304
|
*/
|
436
305
|
extern void frt_store_close(FrtStore *store);
|
437
306
|
|
438
|
-
/**
|
439
|
-
* Flush the buffered contents of the FrtOutStream to the store.
|
440
|
-
*
|
441
|
-
* @param os the FrtOutStream to flush
|
442
|
-
*/
|
443
|
-
extern void frt_os_flush(FrtOutStream *os);
|
444
|
-
|
445
|
-
/**
|
446
|
-
* Close the FrtOutStream after flushing the buffers, also freeing all allocated
|
447
|
-
* resources.
|
448
|
-
*
|
449
|
-
* @param os the FrtOutStream to close
|
450
|
-
*/
|
451
|
-
extern void frt_os_close(FrtOutStream *os);
|
452
|
-
|
453
|
-
/**
|
454
|
-
* Return the current position of FrtOutStream +os+.
|
455
|
-
*
|
456
|
-
* @param os the FrtOutStream to get the position from
|
457
|
-
* @return the current position in FrtOutStream +os+
|
458
|
-
*/
|
459
|
-
extern frt_off_t frt_os_pos(FrtOutStream *os);
|
460
|
-
|
461
|
-
/**
|
462
|
-
* Set the current position in FrtOutStream +os+.
|
463
|
-
*
|
464
|
-
* @param os the FrtOutStream to set the position in
|
465
|
-
* @param pos the new position in the FrtOutStream
|
466
|
-
* @raise FRT_IO_ERROR if there is a file-system IO error seeking the file
|
467
|
-
*/
|
468
|
-
extern void frt_os_seek(FrtOutStream *os, frt_off_t new_pos);
|
469
|
-
|
470
|
-
/**
|
471
|
-
* Write a single byte +b+ to the FrtOutStream +os+
|
472
|
-
*
|
473
|
-
* @param os the FrtOutStream to write to @param b the byte to write @raise
|
474
|
-
* FRT_IO_ERROR if there is an IO error writing to the file-system
|
475
|
-
*/
|
476
|
-
extern void frt_os_write_byte(FrtOutStream *os, frt_uchar b);
|
477
|
-
/**
|
478
|
-
* Write +len+ bytes from buffer +buf+ to the FrtOutStream +os+.
|
479
|
-
*
|
480
|
-
* @param os the FrtOutStream to write to
|
481
|
-
* @param len the number of bytes to write
|
482
|
-
* @param buf the buffer from which to get the bytes to write.
|
483
|
-
* @raise FRT_IO_ERROR if there is an IO error writing to the file-system
|
484
|
-
*/
|
485
|
-
extern void frt_os_write_bytes(FrtOutStream *os, const frt_uchar *buf, int len);
|
486
|
-
|
487
|
-
/**
|
488
|
-
* Write a 32-bit signed integer to the FrtOutStream
|
489
|
-
*
|
490
|
-
* @param os FrtOutStream to write to
|
491
|
-
* @param num the 32-bit signed integer to write
|
492
|
-
* @raise FRT_IO_ERROR if there is an error writing to the file-system
|
493
|
-
*/
|
494
|
-
extern void frt_os_write_i32(FrtOutStream *os, frt_i32 num);
|
495
|
-
|
496
|
-
/**
|
497
|
-
* Write a 64-bit signed integer to the FrtOutStream
|
498
|
-
*
|
499
|
-
*
|
500
|
-
* @param os FrtOutStream to write to
|
501
|
-
* @param num the 64-bit signed integer to write
|
502
|
-
* @raise FRT_IO_ERROR if there is an error writing to the file-system
|
503
|
-
*/
|
504
|
-
extern void frt_os_write_i64(FrtOutStream *os, frt_i64 num);
|
505
|
-
|
506
|
-
/**
|
507
|
-
* Write a 32-bit unsigned integer to the FrtOutStream
|
508
|
-
*
|
509
|
-
* @param os FrtOutStream to write to
|
510
|
-
* @param num the 32-bit unsigned integer to write
|
511
|
-
* @raise FRT_IO_ERROR if there is an error writing to the file-system
|
512
|
-
*/
|
513
|
-
extern void frt_os_write_u32(FrtOutStream *os, frt_u32 num);
|
514
|
-
|
515
|
-
/**
|
516
|
-
* Write a 64-bit unsigned integer to the FrtOutStream
|
517
|
-
*
|
518
|
-
* @param os FrtOutStream to write to
|
519
|
-
* @param num the 64-bit unsigned integer to write
|
520
|
-
* @raise FRT_IO_ERROR if there is an error writing to the file-system
|
521
|
-
*/
|
522
|
-
extern void frt_os_write_u64(FrtOutStream *os, frt_u64 num);
|
523
|
-
|
524
|
-
/**
|
525
|
-
* Write an unsigned integer to FrtOutStream in compressed VINT format.
|
526
|
-
* TODO: describe VINT format
|
527
|
-
*
|
528
|
-
* @param os FrtOutStream to write to
|
529
|
-
* @param num the integer to write
|
530
|
-
* @raise FRT_IO_ERROR if there is an error writing to the file-system
|
531
|
-
*/
|
532
|
-
extern void frt_os_write_vint(FrtOutStream *os, register unsigned int num);
|
533
|
-
|
534
|
-
/**
|
535
|
-
* Write an unsigned frt_off_t to FrtOutStream in compressed VINT format.
|
536
|
-
* TODO: describe VINT format
|
537
|
-
*
|
538
|
-
* @param os FrtOutStream to write to
|
539
|
-
* @param num the frt_off_t to write
|
540
|
-
* @raise FRT_IO_ERROR if there is an error writing to the file-system
|
541
|
-
*/
|
542
|
-
extern void frt_os_write_voff_t(FrtOutStream *os, register frt_off_t num);
|
543
|
-
|
544
|
-
/**
|
545
|
-
* Write an unsigned 64bit int to FrtOutStream in compressed VINT format.
|
546
|
-
* TODO: describe VINT format
|
547
|
-
*
|
548
|
-
* @param os FrtOutStream to write to
|
549
|
-
* @param num the 64bit int to write
|
550
|
-
* @raise FRT_IO_ERROR if there is an error writing to the file-system
|
551
|
-
*/
|
552
|
-
extern void frt_os_write_vll(FrtOutStream *os, register frt_u64 num);
|
553
|
-
|
554
|
-
/**
|
555
|
-
* Write a string with known length to the FrtOutStream. A string is an
|
556
|
-
* integer +length+ in VINT format (see frt_os_write_vint) followed by
|
557
|
-
* +length+ bytes. The string can then be read using frt_is_read_string.
|
558
|
-
*
|
559
|
-
* @param os FrtOutStream to write to
|
560
|
-
* @param str the string to write
|
561
|
-
* @param len the length of the string to write
|
562
|
-
* @raise FRT_IO_ERROR if there is an error writing to the file-system
|
563
|
-
*/
|
564
|
-
extern void frt_os_write_string_len(FrtOutStream *os,
|
565
|
-
const char *str,
|
566
|
-
int len);
|
567
|
-
|
568
|
-
/**
|
569
|
-
* Write a string to the FrtOutStream. A string is an integer +length+ in VINT
|
570
|
-
* format (see frt_os_write_vint) followed by +length+ bytes. The string can then
|
571
|
-
* be read using frt_is_read_string.
|
572
|
-
*
|
573
|
-
* @param os FrtOutStream to write to
|
574
|
-
* @param str the string to write
|
575
|
-
* @raise FRT_IO_ERROR if there is an error writing to the file-system
|
576
|
-
*/
|
577
|
-
extern void frt_os_write_string(FrtOutStream *os, const char *str);
|
578
|
-
|
579
|
-
/**
|
580
|
-
* Get the current position within an FrtInStream.
|
581
|
-
*
|
582
|
-
* @param is the FrtInStream to get the current position from
|
583
|
-
* @return the current position within the FrtInStream +is+
|
584
|
-
*/
|
585
|
-
extern frt_off_t frt_is_pos(FrtInStream *is);
|
586
|
-
|
587
|
-
/**
|
588
|
-
* Set the current position in FrtInStream +is+ to +pos+.
|
589
|
-
*
|
590
|
-
* @param is the FrtInStream to set the current position in
|
591
|
-
* @param pos the position in FrtInStream to seek
|
592
|
-
* @raise FRT_IO_ERROR if there is a error seeking from the file-system
|
593
|
-
* @raise FRT_EOF_ERROR if there is an attempt to seek past the end of the file
|
594
|
-
*/
|
595
|
-
extern void frt_is_seek(FrtInStream *is, frt_off_t pos);
|
596
|
-
|
597
|
-
/**
|
598
|
-
* Close the FrtInStream freeing all allocated resources.
|
599
|
-
*
|
600
|
-
* @param is the FrtInStream to close
|
601
|
-
* @raise FRT_IO_ERROR if there is an error closing the associated file
|
602
|
-
*/
|
603
|
-
extern void frt_is_close(FrtInStream *is);
|
604
|
-
|
605
|
-
/**
|
606
|
-
* Clone the FrtInStream allocating a new FrtInStream structure
|
607
|
-
*
|
608
|
-
* @param is the FrtInStream to clone
|
609
|
-
* @return a newly allocated FrtInStream which is a clone of +is+
|
610
|
-
*/
|
611
|
-
extern FrtInStream *frt_is_clone(FrtInStream *is);
|
612
|
-
|
613
|
-
/**
|
614
|
-
* Read a singly byte (unsigned char) from the FrtInStream +is+.
|
615
|
-
*
|
616
|
-
* @param is the Instream to read from
|
617
|
-
* @return a single unsigned char read from the FrtInStream +is+
|
618
|
-
* @raise FRT_IO_ERROR if there is a error reading from the file-system
|
619
|
-
* @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
|
620
|
-
*/
|
621
|
-
extern frt_uchar frt_is_read_byte(FrtInStream *is);
|
622
|
-
|
623
|
-
/**
|
624
|
-
* Read +len+ bytes from FrtInStream +is+ and write them to buffer +buf+
|
625
|
-
*
|
626
|
-
* @param is the FrtInStream to read from
|
627
|
-
* @param buf the buffer to read into, that is copy the bytes read to
|
628
|
-
* @param len the number of bytes to read
|
629
|
-
* @return the resultant buffer +buf+
|
630
|
-
* @raise FRT_IO_ERROR if there is a error reading from the file-system
|
631
|
-
* @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
|
632
|
-
*/
|
633
|
-
extern frt_uchar *frt_is_read_bytes(FrtInStream *is, frt_uchar *buf, int len);
|
634
|
-
|
635
|
-
/**
|
636
|
-
* Read a 32-bit unsigned integer from the FrtInStream.
|
637
|
-
*
|
638
|
-
* @param is the FrtInStream to read from
|
639
|
-
* @return a 32-bit unsigned integer
|
640
|
-
* @raise FRT_IO_ERROR if there is a error reading from the file-system
|
641
|
-
* @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
|
642
|
-
*/
|
643
|
-
extern frt_i32 frt_is_read_i32(FrtInStream *is);
|
644
|
-
|
645
|
-
/**
|
646
|
-
* Read a 64-bit unsigned integer from the FrtInStream.
|
647
|
-
*
|
648
|
-
* @param is the FrtInStream to read from
|
649
|
-
* @return a 64-bit unsigned integer
|
650
|
-
* @raise FRT_IO_ERROR if there is a error reading from the file-system
|
651
|
-
* @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
|
652
|
-
*/
|
653
|
-
extern frt_i64 frt_is_read_i64(FrtInStream *is);
|
654
|
-
|
655
|
-
/**
|
656
|
-
* Read a 32-bit signed integer from the FrtInStream.
|
657
|
-
*
|
658
|
-
* @param is the FrtInStream to read from
|
659
|
-
* @return a 32-bit signed integer
|
660
|
-
* @raise FRT_IO_ERROR if there is a error reading from the file-system
|
661
|
-
* @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
|
662
|
-
*/
|
663
|
-
extern frt_u32 frt_is_read_u32(FrtInStream *is);
|
664
|
-
|
665
|
-
/**
|
666
|
-
* Read a 64-bit signed integer from the FrtInStream.
|
667
|
-
*
|
668
|
-
* @param is the FrtInStream to read from
|
669
|
-
* @return a 64-bit signed integer
|
670
|
-
* @raise FRT_IO_ERROR if there is a error reading from the file-system
|
671
|
-
* @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
|
672
|
-
*/
|
673
|
-
extern frt_u64 frt_is_read_u64(FrtInStream *is);
|
674
|
-
|
675
|
-
/**
|
676
|
-
* Read a compressed (VINT) unsigned integer from the FrtInStream.
|
677
|
-
* TODO: describe VINT format
|
678
|
-
*
|
679
|
-
* @param is the FrtInStream to read from
|
680
|
-
* @return an int
|
681
|
-
* @raise FRT_IO_ERROR if there is a error reading from the file-system
|
682
|
-
* @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
|
683
|
-
*/
|
684
|
-
extern unsigned int frt_is_read_vint(FrtInStream *is);
|
685
|
-
|
686
|
-
/**
|
687
|
-
* Skip _cnt_ vints. This is a convenience method used for performance reasons
|
688
|
-
* to skip large numbers of vints. It is mostly used by TermDocEnums. When
|
689
|
-
* skipping positions os the proximity index file.
|
690
|
-
*
|
691
|
-
* @param is the FrtInStream to read from
|
692
|
-
* @param cnt the number of vints to skip
|
693
|
-
* @raise FRT_IO_ERROR if there is a error reading from the file-system
|
694
|
-
* @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
|
695
|
-
*/
|
696
|
-
extern void frt_is_skip_vints(FrtInStream *is, register int cnt);
|
697
|
-
|
698
|
-
/**
|
699
|
-
* Read a compressed (VINT) unsigned frt_off_t from the FrtInStream.
|
700
|
-
* TODO: describe VINT format
|
701
|
-
*
|
702
|
-
* @param is the FrtInStream to read from
|
703
|
-
* @return a frt_off_t
|
704
|
-
* @raise FRT_IO_ERROR if there is a error reading from the file-system
|
705
|
-
* @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
|
706
|
-
*/
|
707
|
-
extern frt_off_t frt_is_read_voff_t(FrtInStream *is);
|
708
|
-
|
709
|
-
/**
|
710
|
-
* Read a compressed (VINT) unsigned 64bit int from the FrtInStream.
|
711
|
-
* TODO: describe VINT format
|
712
|
-
*
|
713
|
-
* @param is the FrtInStream to read from
|
714
|
-
* @return a 64bit int
|
715
|
-
* @raise FRT_IO_ERROR if there is a error reading from the file-system
|
716
|
-
* @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
|
717
|
-
*/
|
718
|
-
extern frt_u64 frt_is_read_vll(FrtInStream *is);
|
719
|
-
|
720
|
-
/**
|
721
|
-
* Read a string from the FrtInStream. A string is an integer +length+ in vint
|
722
|
-
* format (see frt_is_read_vint) followed by +length+ bytes. This is the format
|
723
|
-
* used by frt_os_write_string.
|
724
|
-
*
|
725
|
-
* @param is the FrtInStream to read from
|
726
|
-
* @return a null byte delimited string
|
727
|
-
* @raise FRT_IO_ERROR if there is a error reading from the file-system
|
728
|
-
* @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
|
729
|
-
*/
|
730
|
-
extern char *frt_is_read_string(FrtInStream *is);
|
731
|
-
|
732
|
-
/**
|
733
|
-
* Read a string from the FrtInStream. A string is an integer +length+ in vint
|
734
|
-
* format (see frt_is_read_vint) followed by +length+ bytes. This is the format
|
735
|
-
* used by frt_os_write_string. This method is similar to +frt_is_read_string+ except
|
736
|
-
* that it will safely free all memory if there is an error reading the
|
737
|
-
* string.
|
738
|
-
*
|
739
|
-
* @param is the FrtInStream to read from
|
740
|
-
* @return a null byte delimited string
|
741
|
-
* @raise FRT_IO_ERROR if there is a error reading from the file-system
|
742
|
-
* @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
|
743
|
-
*/
|
744
|
-
extern char *frt_is_read_string_safe(FrtInStream *is);
|
745
|
-
|
746
307
|
/**
|
747
308
|
* Copy cnt bytes from Instream _is_ to FrtOutStream _os_.
|
748
309
|
*
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#ifndef FRT_STREAM_H
|
2
|
+
#define FRT_STREAM_H
|
3
|
+
|
4
|
+
#include "frt_global.h"
|
5
|
+
|
6
|
+
#define FRT_COMPRESSION_BUFFER_SIZE 16348
|
7
|
+
|
8
|
+
#define VINT_MAX_LEN 10
|
9
|
+
#define VINT_END FRT_BUFFER_SIZE - VINT_MAX_LEN
|
10
|
+
|
11
|
+
typedef struct FrtBuffer {
|
12
|
+
frt_uchar buf[FRT_BUFFER_SIZE];
|
13
|
+
frt_off_t start;
|
14
|
+
frt_off_t pos;
|
15
|
+
frt_off_t len;
|
16
|
+
} FrtBuffer;
|
17
|
+
|
18
|
+
#endif
|
@@ -1170,7 +1170,6 @@ static void test_iw_add_docs(TestCase *tc, void *data)
|
|
1170
1170
|
for (i = 0; i < BOOK_LIST_LENGTH; i++) {
|
1171
1171
|
frt_iw_add_doc(iw, docs[i]);
|
1172
1172
|
}
|
1173
|
-
frt_iw_optimize(iw);
|
1174
1173
|
Aiequal(BOOK_LIST_LENGTH, frt_iw_doc_count(iw));
|
1175
1174
|
|
1176
1175
|
frt_iw_close(iw);
|
@@ -1279,7 +1278,6 @@ static void test_iw_del_terms(TestCase *tc, void *data)
|
|
1279
1278
|
frt_ir_commit(ir);
|
1280
1279
|
|
1281
1280
|
iw = frt_iw_open(NULL, store, frt_whitespace_analyzer_new(false), &config);
|
1282
|
-
frt_iw_optimize(iw);
|
1283
1281
|
frt_iw_close(iw);
|
1284
1282
|
|
1285
1283
|
frt_ir_close(ir);
|
@@ -1387,9 +1385,6 @@ static ReaderTestEnvironment *reader_test_env_new(int type)
|
|
1387
1385
|
frt_iw_add_doc(iw, doc);
|
1388
1386
|
}
|
1389
1387
|
|
1390
|
-
if (type == segment_reader_type) {
|
1391
|
-
frt_iw_optimize(iw);
|
1392
|
-
}
|
1393
1388
|
frt_iw_close(iw);
|
1394
1389
|
}
|
1395
1390
|
|
@@ -1958,7 +1953,6 @@ static void test_ir_norms(TestCase *tc, void *data)
|
|
1958
1953
|
for (i = 0; i < rte->store_cnt; i++) {
|
1959
1954
|
iw = frt_iw_open(NULL, rte->stores[i], frt_whitespace_analyzer_new(false),
|
1960
1955
|
&frt_default_config);
|
1961
|
-
frt_iw_optimize(iw);
|
1962
1956
|
frt_iw_close(iw);
|
1963
1957
|
}
|
1964
1958
|
|
@@ -2084,7 +2078,6 @@ static void test_ir_delete(TestCase *tc, void *data)
|
|
2084
2078
|
|
2085
2079
|
for (i = 0; i < rte->store_cnt; i++) {
|
2086
2080
|
iw = frt_iw_open(NULL, rte->stores[i], frt_whitespace_analyzer_new(false), &frt_default_config);
|
2087
|
-
frt_iw_optimize(iw);
|
2088
2081
|
frt_iw_close(iw);
|
2089
2082
|
}
|
2090
2083
|
|
@@ -2117,7 +2110,6 @@ static void test_ir_read_while_optimizing(TestCase *tc, void *data)
|
|
2117
2110
|
test_ir_term_doc_enum(tc, ir);
|
2118
2111
|
|
2119
2112
|
iw = frt_iw_open(NULL, store, frt_whitespace_analyzer_new(false), false);
|
2120
|
-
frt_iw_optimize(iw);
|
2121
2113
|
frt_iw_close(iw);
|
2122
2114
|
|
2123
2115
|
test_ir_term_doc_enum(tc, ir);
|
@@ -41,13 +41,6 @@ void dummy_log(const void *fmt, ...) {(void)fmt;}
|
|
41
41
|
#else
|
42
42
|
#define tlog dummy_log
|
43
43
|
#endif
|
44
|
-
/*#define tlog printf */
|
45
|
-
|
46
|
-
static void do_optimize(FrtIndex *index)
|
47
|
-
{
|
48
|
-
tlog("Optimizing the index\n");
|
49
|
-
frt_index_optimize(index);
|
50
|
-
}
|
51
44
|
|
52
45
|
static void do_delete_doc(FrtIndex *index)
|
53
46
|
{
|
@@ -111,9 +104,7 @@ static void *indexing_thread(void *p)
|
|
111
104
|
for (i = 0; i < ITERATIONS; i++) {
|
112
105
|
choice = rand() % 1000;
|
113
106
|
|
114
|
-
if (choice >
|
115
|
-
do_optimize(index);
|
116
|
-
} else if (choice > 900) {
|
107
|
+
if (choice > 900) {
|
117
108
|
do_delete_doc(index);
|
118
109
|
} else if (choice > 700) {
|
119
110
|
do_search(index);
|
@@ -718,17 +718,6 @@ module Isomorfeus
|
|
718
718
|
end
|
719
719
|
alias :commit :flush
|
720
720
|
|
721
|
-
# optimizes the index. This should only be called when the index will no
|
722
|
-
# longer be updated very often, but will be read a lot.
|
723
|
-
def optimize
|
724
|
-
@dir.synchronize do
|
725
|
-
ensure_writer_open
|
726
|
-
@writer.optimize
|
727
|
-
@writer.close
|
728
|
-
@writer = nil
|
729
|
-
end
|
730
|
-
end
|
731
|
-
|
732
721
|
# returns the number of documents in the index
|
733
722
|
def size()
|
734
723
|
@dir.synchronize do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-ferret
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.17.
|
4
|
+
version: 0.17.2
|
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-12-
|
11
|
+
date: 2022-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -209,17 +209,25 @@ files:
|
|
209
209
|
- ext/isomorfeus_ferret_ext/frt_hashset.h
|
210
210
|
- ext/isomorfeus_ferret_ext/frt_helper.c
|
211
211
|
- ext/isomorfeus_ferret_ext/frt_helper.h
|
212
|
+
- ext/isomorfeus_ferret_ext/frt_in_stream.c
|
213
|
+
- ext/isomorfeus_ferret_ext/frt_in_stream.h
|
212
214
|
- ext/isomorfeus_ferret_ext/frt_ind.c
|
213
215
|
- ext/isomorfeus_ferret_ext/frt_ind.h
|
214
216
|
- ext/isomorfeus_ferret_ext/frt_index.c
|
215
217
|
- ext/isomorfeus_ferret_ext/frt_index.h
|
216
218
|
- ext/isomorfeus_ferret_ext/frt_lang.c
|
217
219
|
- ext/isomorfeus_ferret_ext/frt_lang.h
|
220
|
+
- ext/isomorfeus_ferret_ext/frt_lazy_doc.c
|
221
|
+
- ext/isomorfeus_ferret_ext/frt_lazy_doc.h
|
222
|
+
- ext/isomorfeus_ferret_ext/frt_lazy_doc_field.c
|
223
|
+
- ext/isomorfeus_ferret_ext/frt_lazy_doc_field.h
|
218
224
|
- ext/isomorfeus_ferret_ext/frt_mdbx_store.c
|
219
225
|
- ext/isomorfeus_ferret_ext/frt_mempool.c
|
220
226
|
- ext/isomorfeus_ferret_ext/frt_mempool.h
|
221
227
|
- ext/isomorfeus_ferret_ext/frt_multimapper.c
|
222
228
|
- ext/isomorfeus_ferret_ext/frt_multimapper.h
|
229
|
+
- ext/isomorfeus_ferret_ext/frt_out_stream.c
|
230
|
+
- ext/isomorfeus_ferret_ext/frt_out_stream.h
|
223
231
|
- ext/isomorfeus_ferret_ext/frt_posh.c
|
224
232
|
- ext/isomorfeus_ferret_ext/frt_posh.h
|
225
233
|
- ext/isomorfeus_ferret_ext/frt_priorityqueue.c
|
@@ -238,6 +246,7 @@ files:
|
|
238
246
|
- ext/isomorfeus_ferret_ext/frt_q_term.c
|
239
247
|
- ext/isomorfeus_ferret_ext/frt_q_wildcard.c
|
240
248
|
- ext/isomorfeus_ferret_ext/frt_ram_store.c
|
249
|
+
- ext/isomorfeus_ferret_ext/frt_ram_store.h
|
241
250
|
- ext/isomorfeus_ferret_ext/frt_search.c
|
242
251
|
- ext/isomorfeus_ferret_ext/frt_search.h
|
243
252
|
- ext/isomorfeus_ferret_ext/frt_similarity.c
|
@@ -246,6 +255,7 @@ files:
|
|
246
255
|
- ext/isomorfeus_ferret_ext/frt_stopwords.c
|
247
256
|
- ext/isomorfeus_ferret_ext/frt_store.c
|
248
257
|
- ext/isomorfeus_ferret_ext/frt_store.h
|
258
|
+
- ext/isomorfeus_ferret_ext/frt_stream.h
|
249
259
|
- ext/isomorfeus_ferret_ext/frt_term_vectors.c
|
250
260
|
- ext/isomorfeus_ferret_ext/frt_threading.h
|
251
261
|
- ext/isomorfeus_ferret_ext/frt_win32.h
|
@@ -381,7 +391,15 @@ licenses:
|
|
381
391
|
metadata:
|
382
392
|
github_repo: ssh://github.com/isomorfeus/gems
|
383
393
|
source_code_uri: https://github.com/isomorfeus/isomorfeus-ferret
|
384
|
-
post_install_message:
|
394
|
+
post_install_message: |2+
|
395
|
+
|
396
|
+
isomorfeus-ferret 0.17.2:
|
397
|
+
|
398
|
+
Development in progress:
|
399
|
+
- It may eat all your files, when hungry!
|
400
|
+
- Also its required to reindex everything again and again.
|
401
|
+
- Please expect no compatibility with any previous version.
|
402
|
+
|
385
403
|
rdoc_options: []
|
386
404
|
require_paths:
|
387
405
|
- lib
|
@@ -401,3 +419,4 @@ signing_key:
|
|
401
419
|
specification_version: 4
|
402
420
|
summary: Indexed document store for Isomorfeus.
|
403
421
|
test_files: []
|
422
|
+
...
|