Class: Tire::Search::Query::CustomFiltersScoreQuery::CustomFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/tire/search/queries/custom_filters_score.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ CustomFilter

Returns a new instance of CustomFilter



59
60
61
62
# File 'lib/tire/search/queries/custom_filters_score.rb', line 59

def initialize(&block)
  @value = {}
  block.arity < 1 ? self.instance_eval(&block) : block.call(self) if block_given?
end

Instance Method Details

#boost(value) ⇒ Object



69
70
71
72
# File 'lib/tire/search/queries/custom_filters_score.rb', line 69

def boost(value)
  @value[:boost] = value
  @value
end

#filter(type, *options) ⇒ Object



64
65
66
67
# File 'lib/tire/search/queries/custom_filters_score.rb', line 64

def filter(type, *options)
  @value[:filter] = Filter.new(type, *options).to_hash
  @value
end

#script(value) ⇒ Object



74
75
76
77
# File 'lib/tire/search/queries/custom_filters_score.rb', line 74

def script(value)
  @value[:script] = value
  @value
end

#to_hashObject



79
80
81
# File 'lib/tire/search/queries/custom_filters_score.rb', line 79

def to_hash
  @value
end

#to_jsonObject



83
84
85
# File 'lib/tire/search/queries/custom_filters_score.rb', line 83

def to_json
  to_hash.to_json
end