Class: Ferret::Index::SegmentMergeInfo
- Inherits:
-
Object
- Object
- Ferret::Index::SegmentMergeInfo
- Defined in:
- lib/ferret/index/segment_merge_info.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#doc_map ⇒ Object
readonly
Returns the value of attribute doc_map.
-
#postings ⇒ Object
readonly
Returns the value of attribute postings.
-
#reader ⇒ Object
readonly
Returns the value of attribute reader.
-
#term ⇒ Object
readonly
Returns the value of attribute term.
-
#term_enum ⇒ Object
readonly
Returns the value of attribute term_enum.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(base, term_enum, reader) ⇒ SegmentMergeInfo
constructor
A new instance of SegmentMergeInfo.
- #next? ⇒ Boolean
Constructor Details
#initialize(base, term_enum, reader) ⇒ SegmentMergeInfo
Returns a new instance of SegmentMergeInfo.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ferret/index/segment_merge_info.rb', line 6 def initialize(base, term_enum, reader) @base = base @reader = reader @term_enum = term_enum @term = term_enum.term() @postings = @reader.term_positions() # build array which maps document numbers around deletions if (@reader.has_deletions?()) max_doc = @reader.max_doc() @doc_map = Array.new(max_doc) j = 0 max_doc.times do |i| if (@reader.deleted?(i)) @doc_map[i] = -1 else @doc_map[i] = j j += 1 end end end end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
4 5 6 |
# File 'lib/ferret/index/segment_merge_info.rb', line 4 def base @base end |
#doc_map ⇒ Object (readonly)
Returns the value of attribute doc_map.
4 5 6 |
# File 'lib/ferret/index/segment_merge_info.rb', line 4 def doc_map @doc_map end |
#postings ⇒ Object (readonly)
Returns the value of attribute postings.
4 5 6 |
# File 'lib/ferret/index/segment_merge_info.rb', line 4 def postings @postings end |
#reader ⇒ Object (readonly)
Returns the value of attribute reader.
4 5 6 |
# File 'lib/ferret/index/segment_merge_info.rb', line 4 def reader @reader end |
#term ⇒ Object (readonly)
Returns the value of attribute term.
4 5 6 |
# File 'lib/ferret/index/segment_merge_info.rb', line 4 def term @term end |
#term_enum ⇒ Object (readonly)
Returns the value of attribute term_enum.
4 5 6 |
# File 'lib/ferret/index/segment_merge_info.rb', line 4 def term_enum @term_enum end |
Instance Method Details
#close ⇒ Object
39 40 41 42 43 |
# File 'lib/ferret/index/segment_merge_info.rb', line 39 def close() @term_enum.close() @postings.close() @reader = nil end |
#next? ⇒ Boolean
29 30 31 32 33 34 35 36 37 |
# File 'lib/ferret/index/segment_merge_info.rb', line 29 def next? if @term_enum.next? @term = @term_enum.term return true else @term = nil return false end end |