Class: Ferret::Search::Spans::SpansEnum

Inherits:
Object
  • Object
show all
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.

Instance Method Summary collapse

Instance Method Details

#docObject

Returns the document number of the current match. Initially invalid.

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/ferret/search/spans/spans_enum.rb', line 29

def doc()
  raise NotImplementedError
end

#finishObject

Returns the finish position of the current match. Initially invalid.

Raises:

  • (NotImplementedError)


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.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


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.

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/ferret/search/spans/spans_enum.rb', line 24

def skip_to(target)
  raise NotImplementedError
end

#startObject

Returns the start position of the current match. Initially invalid.

Raises:

  • (NotImplementedError)


35
36
37
# File 'lib/ferret/search/spans/spans_enum.rb', line 35

def start()
  raise NotImplementedError
end