Class: Ferret::Index::SegmentReader::Norm
- Inherits:
-
Object
- Object
- Ferret::Index::SegmentReader::Norm
- Defined in:
- lib/ferret/index/segment_reader.rb
Instance Attribute Summary collapse
-
#bytes ⇒ Object
Returns the value of attribute bytes.
-
#dirty ⇒ Object
writeonly
Sets the attribute dirty.
-
#is ⇒ Object
readonly
Returns the value of attribute is.
Instance Method Summary collapse
- #dirty? ⇒ Boolean
-
#initialize(is, number) ⇒ Norm
constructor
A new instance of Norm.
- #re_write(directory, segment, count, cfs_reader) ⇒ Object
Constructor Details
#initialize(is, number) ⇒ Norm
Returns a new instance of Norm.
372 373 374 375 |
# File 'lib/ferret/index/segment_reader.rb', line 372 def initialize(is, number) @is = is @number = number end |
Instance Attribute Details
#bytes ⇒ Object
Returns the value of attribute bytes.
366 367 368 |
# File 'lib/ferret/index/segment_reader.rb', line 366 def bytes @bytes end |
#dirty=(value) ⇒ Object (writeonly)
Sets the attribute dirty
365 366 367 |
# File 'lib/ferret/index/segment_reader.rb', line 365 def dirty=(value) @dirty = value end |
#is ⇒ Object (readonly)
Returns the value of attribute is.
364 365 366 |
# File 'lib/ferret/index/segment_reader.rb', line 364 def is @is end |
Instance Method Details
#dirty? ⇒ Boolean
368 369 370 |
# File 'lib/ferret/index/segment_reader.rb', line 368 def dirty? return @dirty end |
#re_write(directory, segment, count, cfs_reader) ⇒ Object
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
# File 'lib/ferret/index/segment_reader.rb', line 377 def re_write(directory, segment, count, cfs_reader) # NOTE: norms are re-written in regular directory, not cfs out = directory.create_output(segment + ".tmp") begin out.write_bytes(@bytes, count) ensure out.close() end if(cfs_reader == nil) file_name = "#{segment}.f#{@number}" else # use a different file name if we have compound format file_name = "#{segment}.s#{@number}" end directory.rename(segment + ".tmp", file_name) @dirty = false end |