Class: Ferret::Search::MatchAllDocsQuery::MatchAllDocsWeight

Inherits:
Weight
  • Object
show all
Defined in:
lib/ferret/search/match_all_docs_query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query, searcher) ⇒ MatchAllDocsWeight

Returns a new instance of MatchAllDocsWeight.



48
49
50
51
# File 'lib/ferret/search/match_all_docs_query.rb', line 48

def initialize(query, searcher) 
  @query = query
  @searcher = searcher
end

Instance Attribute Details

#queryObject (readonly)

Returns the value of attribute query.



47
48
49
# File 'lib/ferret/search/match_all_docs_query.rb', line 47

def query
  @query
end

Instance Method Details

#explain(reader, doc) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/ferret/search/match_all_docs_query.rb', line 72

def explain(reader, doc) 
  # explain query weight
  query_expl = Explanation.new(1.0, "MatchAllDocsQuery")
  boost_expl = Explanation.new(@query.boost, "boost")
  if (boost_expl.value != 1.0)
    query_expl << boost_expl
    query_expl.value = boost_expl.value
  end

  return query_expl
end

#normalize(query_norm) ⇒ Object



65
66
# File 'lib/ferret/search/match_all_docs_query.rb', line 65

def normalize(query_norm) 
end

#scorer(reader) ⇒ Object



68
69
70
# File 'lib/ferret/search/match_all_docs_query.rb', line 68

def scorer(reader) 
  return MatchAllScorer.new(reader, @query.similarity(@searcher))
end

#sum_of_squared_weightsObject



61
62
63
# File 'lib/ferret/search/match_all_docs_query.rb', line 61

def sum_of_squared_weights() 
  return 1.0
end

#to_sObject



53
54
55
# File 'lib/ferret/search/match_all_docs_query.rb', line 53

def to_s() 
  return "weight(#{@query})"
end

#valueObject



57
58
59
# File 'lib/ferret/search/match_all_docs_query.rb', line 57

def value() 
  return 1.0
end