Method: Sunspot::DSL::Scope#dynamic
- Defined in:
- lib/sunspot/dsl/scope.rb
#dynamic(base_name, &block) ⇒ Object
Apply restrictions, facets, and ordering to dynamic field instances. The block API is implemented by Sunspot::DSL::FieldQuery, which is a superclass of the Query DSL (thus providing a subset of the API, in particular only methods that refer to particular fields).
Parameters
- base_name<Symbol>
-
The base name for the dynamic field definition
Example
Sunspot.search Post do
dynamic :custom do
with :cuisine, 'Pizza'
facet :atmosphere
order_by :chef_name
end
end
166 167 168 169 170 171 |
# File 'lib/sunspot/dsl/scope.rb', line 166 def dynamic(base_name, &block) Sunspot::Util.instance_eval_or_call( Scope.new(@scope, @setup.dynamic_field_factory(base_name)), &block ) end |