Sha256: 6a8c5bb87251f733d9eae7a7703509231d05701bc4419155ff2a8f5c0775a9d9
Contents?: true
Size: 1.87 KB
Versions: 17
Compression:
Stored size: 1.87 KB
Contents
module Sunspot module Query # # A dynamic query is a proxy object that implements the API of the FieldQuery # class, but wraps a dynamic field factory and thus applies the query # components using dynamic field instances. #-- # Dynamic queries do not hold their own state, but rather proxy to the query # that generated them, adding components directly to the owning query's # internal state. #++ # DynamicQuery instances are publicly generated by the Query#dynamic_query # factory method. # class DynamicQuery < FieldQuery def initialize(dynamic_field_factory, query) #:nodoc: @dynamic_field_factory, @query = dynamic_field_factory, query end # # This has the same effect as calling Query#exclude_instance; it is # included for interface completeness. # def exclude_instance(instance) @query.exclude_instance(instance) end # # This has the same effect as calling Query#exclude_instance; it is # included for interface completeness. # def dynamic_query(field_name) @query.dynamic_query(field_name) end # # Add a Sort to the query # def add_sort(sort) #:nodoc: @query.add_sort(sort) end # # Add a component to the query # def add_component(component) #:nodoc: @query.add_component(component) end private # # DynamicFieldFactory implements the part of the Setup interface that we # need, so methods in DynamicQuery's superclasses can rely on it without # knowing what it is. # def setup @dynamic_field_factory end # # So query facets can be added to the query from within dynamic queries # def query_facets @query.query_facets end end end end
Version data entries
17 entries across 17 versions & 6 rubygems