isomorfeus-ferret 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,6 @@ VALUE cLock;
9
9
  VALUE cLockError;
10
10
  VALUE cDirectory;
11
11
  VALUE cRAMDirectory;
12
- VALUE cFSDirectory;
13
12
  VALUE cMDBXDirectory;
14
13
 
15
14
  /****************************************************************************
@@ -79,6 +78,9 @@ const rb_data_type_t frb_lock_t = {
79
78
  * Lock::LockError otherwise.
80
79
  */
81
80
  static VALUE frb_lock_obtain(int argc, VALUE *argv, VALUE self) {
81
+ int ex_code = 0;
82
+ const char *msg = NULL;
83
+
82
84
  VALUE rtimeout;
83
85
  int timeout = 1;
84
86
  FrtLock *lock;
@@ -91,17 +93,28 @@ static VALUE frb_lock_obtain(int argc, VALUE *argv, VALUE self) {
91
93
  timeout = FIX2INT(rtimeout);
92
94
  }
93
95
  end_t = time(NULL) + timeout;
94
- if (lock->obtain(lock)) {
95
- got_lock = true;
96
- }
97
- while (!got_lock && !got_timeout) {
98
- frt_micro_sleep(10000);
96
+ FRT_TRY
99
97
  if (lock->obtain(lock)) {
100
98
  got_lock = true;
101
- } else if (time(NULL) >= end_t) {
102
- got_timeout = true;
103
99
  }
100
+ while (!got_lock && !got_timeout) {
101
+ frt_micro_sleep(10000);
102
+ if (lock->obtain(lock)) {
103
+ got_lock = true;
104
+ } else if (time(NULL) >= end_t) {
105
+ got_timeout = true;
106
+ }
107
+ }
108
+ FRT_XCATCHALL
109
+ ex_code = xcontext.excode;
110
+ msg = xcontext.msg;
111
+ FRT_HANDLED();
112
+ FRT_XENDTRY
113
+
114
+ if (ex_code && msg) {
115
+ frb_raise(ex_code, msg);
104
116
  }
117
+
105
118
  if (!got_lock) {
106
119
  rb_raise(cLockError, "could not obtain lock: #%s", lock->name);
107
120
  }
@@ -123,6 +136,8 @@ static VALUE frb_lock_obtain(int argc, VALUE *argv, VALUE self) {
123
136
  * Lock::LockError otherwise.
124
137
  */
125
138
  static VALUE frb_lock_while_locked(int argc, VALUE *argv, VALUE self) {
139
+ int ex_code = 0;
140
+ const char *msg = NULL;
126
141
  VALUE rtimeout;
127
142
  int timeout = 1;
128
143
  FrtLock *lock;
@@ -135,22 +150,45 @@ static VALUE frb_lock_while_locked(int argc, VALUE *argv, VALUE self) {
135
150
  timeout = FIX2INT(rtimeout);
136
151
  }
137
152
  end_t = time(NULL) + timeout;
138
- if (lock->obtain(lock)) {
139
- got_lock = true;
140
- }
141
- while (!got_lock && !got_timeout) {
142
- frt_micro_sleep(10000);
153
+ FRT_TRY
143
154
  if (lock->obtain(lock)) {
144
155
  got_lock = true;
145
- } else if (time(NULL) >= end_t) {
146
- got_timeout = true;
147
156
  }
157
+ while (!got_lock && !got_timeout) {
158
+ frt_micro_sleep(10000);
159
+ if (lock->obtain(lock)) {
160
+ got_lock = true;
161
+ } else if (time(NULL) >= end_t) {
162
+ got_timeout = true;
163
+ }
164
+ }
165
+ FRT_XCATCHALL
166
+ ex_code = xcontext.excode;
167
+ msg = xcontext.msg;
168
+ FRT_HANDLED();
169
+ FRT_XENDTRY
170
+
171
+ if (ex_code && msg) {
172
+ frb_raise(ex_code, msg);
148
173
  }
174
+
149
175
  if (!got_lock) {
150
176
  rb_raise(cLockError, "could not obtain lock: #%s", lock->name);
151
177
  }
178
+
152
179
  rb_yield(Qnil);
153
- lock->release(lock);
180
+
181
+ FRT_TRY
182
+ lock->release(lock);
183
+ FRT_XCATCHALL
184
+ ex_code = xcontext.excode;
185
+ msg = xcontext.msg;
186
+ FRT_HANDLED();
187
+ FRT_XENDTRY
188
+
189
+ if (ex_code && msg) {
190
+ frb_raise(ex_code, msg);
191
+ }
154
192
  return Qtrue;
155
193
  }
156
194
 
@@ -161,9 +199,24 @@ static VALUE frb_lock_while_locked(int argc, VALUE *argv, VALUE self) {
161
199
  * Returns true if the lock has been obtained.
162
200
  */
163
201
  static VALUE frb_lock_is_locked(VALUE self) {
202
+ int ex_code = 0;
203
+ const char *msg = NULL;
164
204
  FrtLock *lock;
205
+ bool res;
165
206
  GET_LOCK(lock, self);
166
- return lock->is_locked(lock) ? Qtrue : Qfalse;
207
+ FRT_TRY
208
+ res = lock->is_locked(lock);
209
+ FRT_XCATCHALL
210
+ ex_code = xcontext.excode;
211
+ msg = xcontext.msg;
212
+ FRT_HANDLED();
213
+ FRT_XENDTRY
214
+
215
+ if (ex_code && msg) {
216
+ frb_raise(ex_code, msg);
217
+ }
218
+
219
+ return res ? Qtrue : Qfalse;
167
220
  }
168
221
 
169
222
  /*
@@ -174,9 +227,22 @@ static VALUE frb_lock_is_locked(VALUE self) {
174
227
  * the lock.
175
228
  */
176
229
  static VALUE frb_lock_release(VALUE self) {
230
+ int ex_code = 0;
231
+ const char *msg = NULL;
232
+
177
233
  FrtLock *lock;
178
234
  GET_LOCK(lock, self);
179
- lock->release(lock);
235
+ FRT_TRY
236
+ lock->release(lock);
237
+ FRT_XCATCHALL
238
+ ex_code = xcontext.excode;
239
+ msg = xcontext.msg;
240
+ FRT_HANDLED();
241
+ FRT_XENDTRY
242
+
243
+ if (ex_code && msg) {
244
+ frb_raise(ex_code, msg);
245
+ }
180
246
  return self;
181
247
  }
182
248
 
@@ -246,9 +312,25 @@ static VALUE frb_dir_close(VALUE self) {
246
312
  * Return true if a file with the name +file_name+ exists in the directory.
247
313
  */
248
314
  static VALUE frb_dir_exists(VALUE self, VALUE rfname) {
315
+ int ex_code = 0;
316
+ const char *msg = NULL;
249
317
  FrtStore *store = DATA_PTR(self);
250
318
  StringValue(rfname);
251
- return store->exists(store, rs2s(rfname)) ? Qtrue : Qfalse;
319
+ bool res;
320
+
321
+ FRT_TRY
322
+ res = store->exists(store, rs2s(rfname));
323
+ FRT_XCATCHALL
324
+ ex_code = xcontext.excode;
325
+ msg = xcontext.msg;
326
+ FRT_HANDLED();
327
+ FRT_XENDTRY
328
+
329
+ if (ex_code && msg) {
330
+ frb_raise(ex_code, msg);
331
+ }
332
+
333
+ return res ? Qtrue : Qfalse;
252
334
  }
253
335
 
254
336
  /*
@@ -258,9 +340,23 @@ static VALUE frb_dir_exists(VALUE self, VALUE rfname) {
258
340
  * Create an empty file in the directory with the name +file_name+.
259
341
  */
260
342
  static VALUE frb_dir_touch(VALUE self, VALUE rfname) {
343
+ int ex_code = 0;
344
+ const char *msg = NULL;
261
345
  FrtStore *store = DATA_PTR(self);
262
346
  StringValue(rfname);
263
- store->touch(store, rs2s(rfname));
347
+
348
+ FRT_TRY
349
+ store->touch(store, rs2s(rfname));
350
+ FRT_XCATCHALL
351
+ ex_code = xcontext.excode;
352
+ msg = xcontext.msg;
353
+ FRT_HANDLED();
354
+ FRT_XENDTRY
355
+
356
+ if (ex_code && msg) {
357
+ frb_raise(ex_code, msg);
358
+ }
359
+
264
360
  return Qnil;
265
361
  }
266
362
 
@@ -271,9 +367,24 @@ static VALUE frb_dir_touch(VALUE self, VALUE rfname) {
271
367
  * Remove file +file_name+ from the directory. Returns true if successful.
272
368
  */
273
369
  static VALUE frb_dir_delete(VALUE self, VALUE rfname) {
370
+ int ex_code = 0;
371
+ const char *msg = NULL;
274
372
  FrtStore *store = DATA_PTR(self);
275
373
  StringValue(rfname);
276
- return (store->remove(store, rs2s(rfname)) == 0) ? Qtrue : Qfalse;
374
+ bool res;
375
+ FRT_TRY
376
+ res = (store->remove(store, rs2s(rfname)) == 0);
377
+ FRT_XCATCHALL
378
+ ex_code = xcontext.excode;
379
+ msg = xcontext.msg;
380
+ FRT_HANDLED();
381
+ FRT_XENDTRY
382
+
383
+ if (ex_code && msg) {
384
+ frb_raise(ex_code, msg);
385
+ }
386
+
387
+ return res ? Qtrue : Qfalse;
277
388
  }
278
389
 
279
390
  /*
@@ -283,8 +394,23 @@ static VALUE frb_dir_delete(VALUE self, VALUE rfname) {
283
394
  * Return a count of the number of files in the directory.
284
395
  */
285
396
  static VALUE frb_dir_file_count(VALUE self) {
397
+ int ex_code = 0;
398
+ const char *msg = NULL;
286
399
  FrtStore *store = DATA_PTR(self);
287
- return INT2FIX(store->count(store));
400
+ int cnt = 0;
401
+ FRT_TRY
402
+ cnt = INT2FIX(store->count(store));
403
+ FRT_XCATCHALL
404
+ ex_code = xcontext.excode;
405
+ msg = xcontext.msg;
406
+ FRT_HANDLED();
407
+ FRT_XENDTRY
408
+
409
+ if (ex_code && msg) {
410
+ frb_raise(ex_code, msg);
411
+ }
412
+
413
+ return cnt;
288
414
  }
289
415
 
290
416
  /*
@@ -294,8 +420,22 @@ static VALUE frb_dir_file_count(VALUE self) {
294
420
  * Delete all files in the directory. It gives you a clean slate.
295
421
  */
296
422
  static VALUE frb_dir_refresh(VALUE self) {
423
+ int ex_code = 0;
424
+ const char *msg = NULL;
297
425
  FrtStore *store = DATA_PTR(self);
298
- store->clear_all(store);
426
+
427
+ FRT_TRY
428
+ store->clear_all(store);
429
+ FRT_XCATCHALL
430
+ ex_code = xcontext.excode;
431
+ msg = xcontext.msg;
432
+ FRT_HANDLED();
433
+ FRT_XENDTRY
434
+
435
+ if (ex_code && msg) {
436
+ frb_raise(ex_code, msg);
437
+ }
438
+
299
439
  return self;
300
440
  }
301
441
 
@@ -307,10 +447,24 @@ static VALUE frb_dir_refresh(VALUE self) {
307
447
  * doesn't exist or there is some other type of IOError.
308
448
  */
309
449
  static VALUE frb_dir_rename(VALUE self, VALUE rfrom, VALUE rto) {
450
+ int ex_code = 0;
451
+ const char *msg = NULL;
452
+
310
453
  FrtStore *store = DATA_PTR(self);
311
454
  StringValue(rfrom);
312
455
  StringValue(rto);
313
- store->rename(store, rs2s(rfrom), rs2s(rto));
456
+ FRT_TRY
457
+ store->rename(store, rs2s(rfrom), rs2s(rto));
458
+ FRT_XCATCHALL
459
+ ex_code = xcontext.excode;
460
+ msg = xcontext.msg;
461
+ FRT_HANDLED();
462
+ FRT_XENDTRY
463
+
464
+ if (ex_code && msg) {
465
+ frb_raise(ex_code, msg);
466
+ }
467
+
314
468
  return self;
315
469
  }
316
470
 
@@ -324,11 +478,25 @@ static VALUE frb_dir_rename(VALUE self, VALUE rfrom, VALUE rto) {
324
478
  * reserved for lock files
325
479
  */
326
480
  static VALUE frb_dir_make_lock(VALUE self, VALUE rlock_name) {
481
+ int ex_code = 0;
482
+ const char *msg = NULL;
483
+
327
484
  VALUE rlock;
328
485
  FrtLock *lock;
329
486
  FrtStore *store = DATA_PTR(self);
330
487
  StringValue(rlock_name);
331
- lock = frt_open_lock(store, rs2s(rlock_name));
488
+ FRT_TRY
489
+ lock = frt_open_lock(store, rs2s(rlock_name));
490
+ FRT_XCATCHALL
491
+ ex_code = xcontext.excode;
492
+ msg = xcontext.msg;
493
+ FRT_HANDLED();
494
+ FRT_XENDTRY
495
+
496
+ if (ex_code && msg) {
497
+ frb_raise(ex_code, msg);
498
+ }
499
+
332
500
  rlock = TypedData_Wrap_Struct(cLock, &frb_lock_t, lock);
333
501
  lock->rlock = rlock;
334
502
  return rlock;
@@ -346,7 +514,7 @@ static VALUE frb_dir_make_lock(VALUE self, VALUE rlock_name) {
346
514
  *
347
515
  * Create a new RAMDirectory.
348
516
  *
349
- * You can optionally load another Directory (usually a FSDirectory) into
517
+ * You can optionally load another Directory (usually a MDBXDirectory) into
350
518
  * memory. This may be useful to speed up search performance but usually the
351
519
  * speedup won't be worth the trouble. Be sure to benchmark.
352
520
  *
@@ -371,55 +539,6 @@ static VALUE frb_ramdir_init(int argc, VALUE *argv, VALUE self) {
371
539
  return self;
372
540
  }
373
541
 
374
- /****************************************************************************
375
- *
376
- * FSDirectory Methods
377
- *
378
- ****************************************************************************/
379
-
380
- /*
381
- * call-seq:
382
- * FSDirectory.new(/path/to/index/, create = false)
383
- *
384
- * Create a new FSDirectory at +/path/to/index/+ which must be a valid path
385
- * on your file system. If it doesn't exist it will be created. You can also
386
- * specify the +create+ parameter. If +create+ is true the FSDirectory will
387
- * be refreshed as new. That is to say, any existing files in the directory
388
- * will be deleted. The default value for +create+ is false.
389
- *
390
- * path:: path to index directory. Must be a valid path on your system
391
- * create:: set to true if you want any existing files in the directory to be
392
- * deleted
393
- */
394
- static VALUE frb_fsdir_new(int argc, VALUE *argv, VALUE klass) {
395
- VALUE self, rpath, rcreate;
396
- FrtStore *store;
397
- bool create;
398
-
399
- rb_scan_args(argc, argv, "11", &rpath, &rcreate);
400
- StringValue(rpath);
401
- create = RTEST(rcreate);
402
- if (create) {
403
- frb_create_dir(rpath);
404
- }
405
- if (!rb_funcall(rb_cFile, id_is_directory, 1, rpath)) {
406
- rb_raise(cFileNotFoundError, "No directory <%s> found. Use :create => true to create one.", rs2s(rpath));
407
- }
408
- store = frt_open_fs_store(rs2s(rpath));
409
- if (create) store->clear_all(store);
410
- self = store->rstore;
411
- if (self == Qnil || DATA_PTR(self) == NULL) {
412
- self = TypedData_Wrap_Struct(klass, &frb_store_t, store);
413
- store->rstore = self;
414
- rb_ivar_set(self, id_ref_cnt, INT2FIX(0));
415
- } else {
416
- int ref_cnt = FIX2INT(rb_ivar_get(self, id_ref_cnt)) + 1;
417
- rb_ivar_set(self, id_ref_cnt, INT2FIX(ref_cnt));
418
- }
419
- return self;
420
- }
421
-
422
-
423
542
  /****************************************************************************
424
543
  *
425
544
  * MDBXDirectory Methods
@@ -432,7 +551,7 @@ static VALUE frb_fsdir_new(int argc, VALUE *argv, VALUE klass) {
432
551
  *
433
552
  * Create a new MDBXDirectory at +/path/to/env/+ which must be a valid path
434
553
  * on your file system. If it doesn't exist it will be created. You can also
435
- * specify the +create+ parameter. If +create+ is true the FSDirectory will
554
+ * specify the +create+ parameter. If +create+ is true the MDBXDirectory will
436
555
  * be refreshed as new. That is to say, any existing files in the directory
437
556
  * will be deleted. The default value for +create+ is false.
438
557
  *
@@ -441,30 +560,49 @@ static VALUE frb_fsdir_new(int argc, VALUE *argv, VALUE klass) {
441
560
  * deleted
442
561
  */
443
562
  static VALUE frb_mdbxdir_new(int argc, VALUE *argv, VALUE klass) {
444
- VALUE self, rpath, rcreate;
563
+ VALUE self, rpath, mdbx_rpath, rcreate;
445
564
  FrtStore *store;
446
565
  bool create;
447
566
 
567
+ int ex_code = 0;
568
+ const char *msg = NULL;
569
+
448
570
  rb_scan_args(argc, argv, "11", &rpath, &rcreate);
449
571
  StringValue(rpath);
572
+
450
573
  create = RTEST(rcreate);
451
574
  if (create) {
452
575
  frb_create_dir(rpath);
453
- }
454
- if (!rb_funcall(rb_cFile, id_is_directory, 1, rpath)) {
455
- rb_raise(cFileNotFoundError, "No directory <%s> found. Use :create => true to create one.", rs2s(rpath));
456
- }
457
- store = frt_open_mdbx_store(rs2s(rpath));
458
- if (create) store->clear_all(store);
459
- self = store->rstore;
460
- if (self == Qnil || DATA_PTR(self) == NULL) {
461
- self = TypedData_Wrap_Struct(klass, &frb_store_t, store);
462
- store->rstore = self;
463
- rb_ivar_set(self, id_ref_cnt, INT2FIX(0));
464
576
  } else {
465
- int ref_cnt = FIX2INT(rb_ivar_get(self, id_ref_cnt)) + 1;
466
- rb_ivar_set(self, id_ref_cnt, INT2FIX(ref_cnt));
577
+ mdbx_rpath = rb_str_dup(rpath);
578
+ rb_str_cat_cstr(mdbx_rpath, "/mdbx.dat");
579
+ if (!rb_funcall(rb_cFile, id_exist, 1, mdbx_rpath)) {
580
+ rb_raise(cFileNotFoundError, "No database at <%s> found. Use :create => true to create one.", rs2s(rpath));
581
+ }
467
582
  }
583
+
584
+ FRT_TRY
585
+ store = frt_open_mdbx_store(rs2s(rpath));
586
+ if (create) store->clear_all(store);
587
+ self = store->rstore;
588
+ if (self == Qnil || DATA_PTR(self) == NULL) {
589
+ self = TypedData_Wrap_Struct(klass, &frb_store_t, store);
590
+ store->rstore = self;
591
+ rb_ivar_set(self, id_ref_cnt, INT2FIX(0));
592
+ } else {
593
+ int ref_cnt = FIX2INT(rb_ivar_get(self, id_ref_cnt)) + 1;
594
+ rb_ivar_set(self, id_ref_cnt, INT2FIX(ref_cnt));
595
+ }
596
+ FRT_XCATCHALL
597
+ ex_code = xcontext.excode;
598
+ msg = xcontext.msg;
599
+ FRT_HANDLED();
600
+ FRT_XENDTRY
601
+
602
+ if (ex_code && msg) {
603
+ frb_raise(ex_code, msg);
604
+ }
605
+
468
606
  return self;
469
607
  }
470
608
 
@@ -481,7 +619,7 @@ static VALUE frb_mdbxdir_new(int argc, VALUE *argv, VALUE klass) {
481
619
  * Ruby's IO API is not used so that we can use different storage
482
620
  * mechanisms to store the index. Some examples are;
483
621
  *
484
- * * File system based storage (currently implemented as FSDirectory)
622
+ * * MDBX system based storage (currently implemented as MDBXDirectory)
485
623
  * * RAM based storage (currently implemented as RAMDirectory)
486
624
  * * Database based storage
487
625
  *
@@ -497,6 +635,7 @@ void Init_Directory(void) {
497
635
  rb_define_const(cDirectory, "LOCK_PREFIX", rb_str_new2(FRT_LOCK_PREFIX));
498
636
  rb_define_method(cDirectory, "close", frb_dir_close, 0);
499
637
  rb_define_method(cDirectory, "exists?", frb_dir_exists, 1);
638
+ rb_define_method(cDirectory, "exist?", frb_dir_exists, 1);
500
639
  rb_define_method(cDirectory, "touch", frb_dir_touch, 1);
501
640
  rb_define_method(cDirectory, "delete", frb_dir_delete, 1);
502
641
  rb_define_method(cDirectory, "file_count", frb_dir_file_count, 0);
@@ -542,7 +681,7 @@ void Init_Lock(void) {
542
681
  * Document-class: Ferret::Store::RAMDirectory
543
682
  *
544
683
  * Memory resident Directory implementation. You should use a RAMDirectory
545
- * during testing but otherwise you should stick with FSDirectory. While
684
+ * during testing but otherwise you should stick with MDBXDirectory. While
546
685
  * loading an index into memory may slightly speed things up, on most
547
686
  * operating systems there won't be much difference so it wouldn't be worth
548
687
  * your trouble.
@@ -553,21 +692,6 @@ void Init_RAMDirectory(void) {
553
692
  rb_define_method(cRAMDirectory, "initialize", frb_ramdir_init, -1);
554
693
  }
555
694
 
556
- /*
557
- * Document-class: Ferret::Store::FSDirectory
558
- *
559
- * File-system resident Directory implementation. The FSDirectory will use a
560
- * single directory to store all of it's files. You should not otherwise
561
- * touch this directory. Modifying the files in the directory will corrupt
562
- * the index. The one exception to this rule is you may need to delete stale
563
- * lock files which have a ".lck" extension.
564
- */
565
- void Init_FSDirectory(void) {
566
- cFSDirectory = rb_define_class_under(mStore, "FSDirectory", cDirectory);
567
- rb_define_alloc_func(cFSDirectory, frb_store_alloc);
568
- rb_define_singleton_method(cFSDirectory, "new", frb_fsdir_new, -1);
569
- }
570
-
571
695
  /*
572
696
  * Document-class: Ferret::Store::MDBXDirectory
573
697
  *
@@ -599,6 +723,5 @@ void Init_Store(void) {
599
723
  Init_Directory();
600
724
  Init_Lock();
601
725
  Init_RAMDirectory();
602
- Init_FSDirectory();
603
726
  Init_MDBXDirectory();
604
727
  }
@@ -152,7 +152,7 @@ static FrtInStream *cmpd_open_input(FrtStore *store, const char *file_name) {
152
152
  entry = (FileEntry *)frt_h_get(cmpd->entries, file_name);
153
153
  if (entry == NULL) {
154
154
  pthread_mutex_unlock(&store->mutex);
155
- FRT_RAISE(FRT_IO_ERROR, "File %s does not exist: ", file_name);
155
+ FRT_RAISE(FRT_IO_ERROR, "File '%s' does not exist: ", file_name);
156
156
  }
157
157
 
158
158
  is = cmpd_create_input(cmpd->stream, entry->offset, entry->length);
@@ -6048,8 +6048,7 @@ static void iw_maybe_merge_segments(FrtIndexWriter *iw)
6048
6048
  }
6049
6049
  }
6050
6050
 
6051
- static void iw_flush_ram_segment(FrtIndexWriter *iw)
6052
- {
6051
+ static void iw_flush_ram_segment(FrtIndexWriter *iw) {
6053
6052
  FrtSegmentInfos *sis = iw->sis;
6054
6053
  FrtSegmentInfo *si;
6055
6054
  si = sis->segs[sis->size - 1];
@@ -6474,8 +6473,7 @@ static void iw_cp_files(FrtIndexWriter *iw, FrtSegmentReader *sr, FrtSegmentInfo
6474
6473
  iw_cp_norms( iw, sr, si, NULL);
6475
6474
  }
6476
6475
 
6477
- static void iw_add_segment(FrtIndexWriter *iw, FrtSegmentReader *sr)
6478
- {
6476
+ static void iw_add_segment(FrtIndexWriter *iw, FrtSegmentReader *sr) {
6479
6477
  FrtSegmentInfo *si = frt_sis_new_segment(iw->sis, 0, iw->store);
6480
6478
  FrtFieldInfos *fis = iw->fis;
6481
6479
  FrtFieldInfos *sub_fis = sr->ir.fis;
@@ -6500,18 +6498,15 @@ static void iw_add_segment(FrtIndexWriter *iw, FrtSegmentReader *sr)
6500
6498
 
6501
6499
  if (must_map_fields) {
6502
6500
  iw_cp_map_files(iw, sr, si);
6503
- }
6504
- else {
6501
+ } else {
6505
6502
  iw_cp_files(iw, sr, si);
6506
6503
  }
6507
6504
  }
6508
6505
 
6509
- static void iw_add_segments(FrtIndexWriter *iw, FrtIndexReader *ir)
6510
- {
6506
+ static void iw_add_segments(FrtIndexWriter *iw, FrtIndexReader *ir) {
6511
6507
  if (ir->num_docs == sr_num_docs) {
6512
6508
  iw_add_segment(iw, SR(ir));
6513
- }
6514
- else {
6509
+ } else {
6515
6510
  int i;
6516
6511
  const int r_cnt = MR(ir)->r_cnt;
6517
6512
  FrtIndexReader **readers = MR(ir)->sub_readers;
@@ -6521,8 +6516,7 @@ static void iw_add_segments(FrtIndexWriter *iw, FrtIndexReader *ir)
6521
6516
  }
6522
6517
  }
6523
6518
 
6524
- void frt_iw_add_readers(FrtIndexWriter *iw, FrtIndexReader **readers, const int r_cnt)
6525
- {
6519
+ void frt_iw_add_readers(FrtIndexWriter *iw, FrtIndexReader **readers, const int r_cnt) {
6526
6520
  int i;
6527
6521
  pthread_mutex_lock(&iw->mutex);
6528
6522
  iw_optimize_i(iw);