# File lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb, line 13 def initialize(attribute, source) @attribute, @source = attribute, source end
# File lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb, line 17 def collection_type @attribute.multi? ? :multi : sphinx_type end
# File lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb, line 21 def declaration if @attribute.multi? multi_declaration else @attribute.name end end
# File lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb, line 29 def sphinx_type SPHINX_TYPES[@attribute.type] end
# File lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb, line 35 def multi_declaration case @attribute.source_type when :query, :ranged_query query else "#{sphinx_type} #{@attribute.name} from field" end end
# File lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb, line 44 def query ThinkingSphinx::ActiveRecord::PropertyQuery.new( @attribute, @source, sphinx_type ).to_s end