Class: Ferret::Index::TermEnum
- Inherits:
-
Object
- Object
- Ferret::Index::TermEnum
- Defined in:
- lib/ferret/index/term_enum.rb
Overview
Abstract class for enumerating terms.
Term enumerations are always ordered by Term.<=>. Each term in the enumeration is greater than all that precede it.
Direct Known Subclasses
Instance Method Summary collapse
-
#close ⇒ Object
Closes the enumeration to further activity, freeing resources.
-
#doc_freq ⇒ Object
Returns the doc_freq of the current Term in the enumeration.
-
#next? ⇒ Boolean
Increments the enumeration to the next element.
-
#skip_to(term) ⇒ Object
Term Vector support Skips terms to the first beyond the current whose value is greater or equal to target.
-
#term ⇒ Object
Returns the current Term in the enumeration.
Instance Method Details
#close ⇒ Object
Closes the enumeration to further activity, freeing resources.
24 25 26 |
# File 'lib/ferret/index/term_enum.rb', line 24 def close raise NotImplementedError end |
#doc_freq ⇒ Object
Returns the doc_freq of the current Term in the enumeration.
19 20 21 |
# File 'lib/ferret/index/term_enum.rb', line 19 def doc_freq raise NotImplementedError end |
#next? ⇒ Boolean
Increments the enumeration to the next element. True if one exists.
9 10 11 |
# File 'lib/ferret/index/term_enum.rb', line 9 def next? raise NotImplementedError end |
#skip_to(term) ⇒ Object
Term Vector support Skips terms to the first beyond the current whose value is greater or equal to target.
Returns true iff there is such a term.
Behaves as if written:
def skip_to(target_term)
while (target > term)
if (!next()) return false
end
return true
end
Some implementations are considerably more efficient than that.
44 45 46 47 48 49 |
# File 'lib/ferret/index/term_enum.rb', line 44 def skip_to(term) while (target > term) return false if not next? end return true end |
#term ⇒ Object
Returns the current Term in the enumeration.
14 15 16 |
# File 'lib/ferret/index/term_enum.rb', line 14 def term raise NotImplementedError end |