Class: Ferret::Search::ScoreDocComparator
- Inherits:
-
Object
- Object
- Ferret::Search::ScoreDocComparator
- Defined in:
- lib/ferret/search/score_doc_comparator.rb
Overview
Expert: Compares two ScoreDoc objects for sorting.
Direct Known Subclasses
Constant Summary collapse
- RELEVANCE =
Special comparator for sorting hits according to computed relevance (score).
ScoreDocComparator.new()
- INDEX_ORDER =
Special comparator for sorting hits according to index order (number).
ScoreDocComparator.new()
Instance Method Summary collapse
-
#compare(i, j) ⇒ Object
Compares two ScoreDoc objects and returns a result indicating their sort order.
-
#sort_type ⇒ Object
Returns the type of sort.
-
#sort_value(i) ⇒ Object
Returns the value used to sort the given document.
Instance Method Details
#compare(i, j) ⇒ Object
Compares two ScoreDoc objects and returns a result indicating their sort order.
- i
-
First ScoreDoc
- j
-
Second ScoreDoc
- returns
-
-1
ifi
should come beforej
1
ifi
should come afterj
0
if they are equal
42 43 44 |
# File 'lib/ferret/search/score_doc_comparator.rb', line 42 def compare(i, j) return NotImplementedError end |
#sort_type ⇒ Object
Returns the type of sort. Should return SortField.SCORE
, SortField.DOC
, SortField.STRING
, SortField.INTEGER
, SortField.FLOAT
or SortField.CUSTOM
. It is not valid to return SortField.AUTO
. This is used by multisearchers to determine how to collate results from
- their searchers. returns
-
One of the constants in SortField.
See SortField
66 67 68 |
# File 'lib/ferret/search/score_doc_comparator.rb', line 66 def sort_type() return NotImplementedError end |
#sort_value(i) ⇒ Object
Returns the value used to sort the given document. The object returned must implement the java.io.Serializable interface. This is used by multisearchers to determine how to collate results from their searchers.
See FieldDoc
- i
-
Document
- returns
-
Serializable object
54 55 56 |
# File 'lib/ferret/search/score_doc_comparator.rb', line 54 def sort_value(i) return NotImplementedError end |