class ThinkingSphinx::Middlewares::SphinxQL::Inner::Statement
Attributes
query[RW]
report[RW]
Public Class Methods
new(report)
click to toggle source
# File lib/thinking_sphinx/middlewares/sphinxql.rb, line 167 def initialize(report) self.report = report self.query = Riddle::Query::Select.new end
Public Instance Methods
to_riddle_query_select()
click to toggle source
# File lib/thinking_sphinx/middlewares/sphinxql.rb, line 172 def to_riddle_query_select filter_by_scopes query end
Protected Instance Methods
filter_by_scopes()
click to toggle source
# File lib/thinking_sphinx/middlewares/sphinxql.rb, line 180 def filter_by_scopes scope_by_from scope_by_values scope_by_extended_query scope_by_inclusive_filters scope_by_with_all scope_by_exclusive_filters scope_by_without_all scope_by_order scope_by_group scope_by_pagination scope_by_options end
method_missing(*args, &block)
click to toggle source
# File lib/thinking_sphinx/middlewares/sphinxql.rb, line 243 def method_missing(*args, &block) report.send *args, &block end
scope_by_exclusive_filters()
click to toggle source
# File lib/thinking_sphinx/middlewares/sphinxql.rb, line 215 def scope_by_exclusive_filters query.where_not exclusive_filters if exclusive_filters.any? end
scope_by_extended_query()
click to toggle source
# File lib/thinking_sphinx/middlewares/sphinxql.rb, line 203 def scope_by_extended_query query.matching extended_query if extended_query.present? end
scope_by_from()
click to toggle source
# File lib/thinking_sphinx/middlewares/sphinxql.rb, line 195 def scope_by_from query.from *(index_names.collect { |index| "`#{index}`" }) end
scope_by_group()
click to toggle source
# File lib/thinking_sphinx/middlewares/sphinxql.rb, line 227 def scope_by_group query.group_by group_attribute if group_attribute.present? query.group_best options[:group_best] if options[:group_best] query.order_within_group_by group_order_clause if group_order_clause.present? query.having options[:having] if options[:having] end
scope_by_inclusive_filters()
click to toggle source
# File lib/thinking_sphinx/middlewares/sphinxql.rb, line 207 def scope_by_inclusive_filters query.where inclusive_filters if inclusive_filters.any? end
scope_by_options()
click to toggle source
# File lib/thinking_sphinx/middlewares/sphinxql.rb, line 239 def scope_by_options query.with_options select_options if select_options.keys.any? end
scope_by_order()
click to toggle source
# File lib/thinking_sphinx/middlewares/sphinxql.rb, line 223 def scope_by_order query.order_by order_clause if order_clause.present? end
scope_by_pagination()
click to toggle source
# File lib/thinking_sphinx/middlewares/sphinxql.rb, line 234 def scope_by_pagination query.offset context.search.offset query.limit context.search.per_page end
scope_by_values()
click to toggle source
# File lib/thinking_sphinx/middlewares/sphinxql.rb, line 199 def scope_by_values query.values(values.present? ? values : '*') end
scope_by_with_all()
click to toggle source
# File lib/thinking_sphinx/middlewares/sphinxql.rb, line 211 def scope_by_with_all query.where_all options[:with_all] if options[:with_all] end
scope_by_without_all()
click to toggle source
# File lib/thinking_sphinx/middlewares/sphinxql.rb, line 219 def scope_by_without_all query.where_not_all options[:without_all] if options[:without_all] end