Class: Sunspot::DSL::Search

Inherits:
StandardQuery show all
Defined in:
sunspot/lib/sunspot/dsl/search.rb

Overview

This top-level DSL class is the context in which the block passed to Sunspot.query. See Sunspot::DSL::StandardQuery, Sunspot::DSL::FieldQuery, and Sunspot::DSL::Scope for the full API presented.

Constant Summary

Constants inherited from Scope

NONE

Instance Method Summary (collapse)

Methods inherited from StandardQuery

#fulltext, #with

Methods included from Adjustable

#adjust_solr_params, #request_handler

Methods included from Paginatable

#paginate

Methods inherited from FieldQuery

#dynamic, #facet, #order_by, #order_by_random

Methods inherited from Scope

#all_of, #any_of, #dynamic, #text_fields, #with, #without

Constructor Details

- (Search) initialize(search, setup)

:nodoc:



9
10
11
12
# File 'sunspot/lib/sunspot/dsl/search.rb', line 9

def initialize(search, setup) #:nodoc:
  @search = search
  super(search, search.query, setup)
end

Instance Method Details

- (Object) data_accessor_for(clazz)

Retrieve the data accessor used to load instances of the given class out of persistent storage. Data accessors are free to implement any extra methods that may be useful in this context.

Example

  Sunspot.search Post do
    data_acccessor_for(Post).includes = [:blog, :comments]
  end


25
26
27
# File 'sunspot/lib/sunspot/dsl/search.rb', line 25

def data_accessor_for(clazz)
  @search.data_accessor_for(clazz)
end