Skip to content

Instantly share code, notes, and snippets.

@raysrashmi
Created January 25, 2013 16:36
Show Gist options
  • Select an option

  • Save raysrashmi/4635845 to your computer and use it in GitHub Desktop.

Select an option

Save raysrashmi/4635845 to your computer and use it in GitHub Desktop.
define_index do
indexes name, :sortable => true, :infixes => true
indexes nickname, :sortable => true, :infixes => true
indexes city_code
indexes address
indexes state
indexes city, :sortable => true, :infixes => true
set_property :enable_star => 1 # Both are needed to allow stars in search
set_property :min_prefix_len => 1 # Both are needed to allow stars in search
has "RADIANS(latitude)", :as => :latitude, :type => :float
has "RADIANS(longitude)", :as => :longitude, :type => :float
# join franchises
end
sphinx_scope(:ny_ca_and_ma_only) {
{:conditions => ["gyms.address IS NOT NULL AND (gyms.state in (?)", ['MA', 'CA', 'NY']]}
}
@arunagw

arunagw commented Jan 25, 2013

Copy link
Copy Markdown
sphinx_scope(:ny_ca_and_ma_only) do
    {:conditions => ["gyms.address IS NOT NULL AND (gyms.state in (?)", ['MA', 'CA', 'NY']]}
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment