Sha256: 0a5f9704bec1e8b91435b47629848c86bd4a207f837b2251ca309458fcb4b9c6

Contents?: true

Size: 924 Bytes

Versions: 2

Compression:

Stored size: 924 Bytes

Contents

require "#{File.dirname(__FILE__)}/tag"
require "#{File.dirname(__FILE__)}/tagging"

class Developer < ActiveRecord::Base
  has_many :taggings, :as => :taggable
  has_many :tags, :through => :taggings
  
  define_index do
    indexes country,                      :facet => true
    indexes state,                        :facet => true
    indexes tags.text,  :as => :tags,     :facet => true
    
    has age,                              :facet => true
    has tags(:id),      :as => :tag_ids,  :facet => true
    
    facet "LOWER(city)", :as => :city, :type => :string, :value => :city
    
    group_by 'city'
  end
  
  define_index 'alternate' do
    indexes "'foo'",     :as => :foo
    
    has age,                              :facet => true
    has tags(:id),       :as => :tag_ids,  :facet => true
    
    facet "LOWER(city)", :as => :city, :type => :string, :value => :city
    
    group_by 'city'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thinking-sphinx-2.0.3 features/thinking_sphinx/models/developer.rb
thinking-sphinx-1.4.4 features/thinking_sphinx/models/developer.rb