Module: Skyline::SearchableItem::ClassMethods

Defined in:
lib/skyline/searchable_item.rb

Instance Method Summary collapse

Instance Method Details

#indexer_option(options) ⇒ Object

Method to set options for the indexer

Parameters

options<Hash>

Options

:if a method or lambda function which should return true for the indexing process to continue



65
66
67
# File 'lib/skyline/searchable_item.rb', line 65

def indexer_option(options)
  self.indexer_options = options
end

#searchable_field(fields) ⇒ Object

Method to add fields from the model to the solr index

Parameters

fields<Hash>::hash of fields as field => solr-field

Options

if field is symbol then the value of the field is indexed if field is a string then the string itself is indexed if field is a Proc, the result of calling the Proc (with myself as argument) is indexed

solr-field must be pressent in solr configuration



52
53
54
55
56
57
# File 'lib/skyline/searchable_item.rb', line 52

def searchable_field(fields)
	self.searchable_fields ||= {} 			
	fields.each do |sf, f|
     self.searchable_fields.merge!(sf => f)
   end
end