Class: Ferret::Search::Spans::SpansEnum
- Inherits:
-
Object
- Object
- Ferret::Search::Spans::SpansEnum
- Defined in:
- lib/ferret/search/spans/spans_enum.rb
Overview
Expert: an enumeration of span matches. Used to implement span searching. Each span represents a range of term positions within a document. Matches are enumerated in order, by increasing document number, within that by increasing start position and ensure by increasing finish position.
Direct Known Subclasses
NearSpansEnum, NearSpansEnum::SpansCell, Ferret::Search::Spans::SpanFirstQuery::SpanFirstEnum, Ferret::Search::Spans::SpanNotQuery::SpanNotEnum, Ferret::Search::Spans::SpanOrQuery::SpanOrEnum, Ferret::Search::Spans::SpanTermQuery::SpanTermEnum
Instance Method Summary collapse
-
#doc ⇒ Object
Returns the document number of the current match.
-
#finish ⇒ Object
Returns the finish position of the current match.
-
#next? ⇒ Boolean
Move to the next match, returning true iff any such exists.
-
#skip_to(target) ⇒ Object
Skips to the first match beyond the current, whose document number is greater than or equal to target.
-
#start ⇒ Object
Returns the start position of the current match.
Instance Method Details
#doc ⇒ Object
Returns the document number of the current match. Initially invalid.
29 30 31 |
# File 'lib/ferret/search/spans/spans_enum.rb', line 29 def doc() raise NotImplementedError end |
#finish ⇒ Object
Returns the finish position of the current match. Initially invalid.
40 41 42 |
# File 'lib/ferret/search/spans/spans_enum.rb', line 40 def finish() raise NotImplementedError end |
#next? ⇒ Boolean
Move to the next match, returning true iff any such exists.
8 9 10 |
# File 'lib/ferret/search/spans/spans_enum.rb', line 8 def next?() raise NotImplementedError end |
#skip_to(target) ⇒ Object
Skips to the first match beyond the current, whose document number is greater than or equal to target. Returns true iff there is such a match. Behaves as if written:
def skip_to(target)
begin
return false if (!next?)
end while (target > doc)
return true
end
Most implementations are considerably more efficient than that.
24 25 26 |
# File 'lib/ferret/search/spans/spans_enum.rb', line 24 def skip_to(target) raise NotImplementedError end |
#start ⇒ Object
Returns the start position of the current match. Initially invalid.
35 36 37 |
# File 'lib/ferret/search/spans/spans_enum.rb', line 35 def start() raise NotImplementedError end |