Skip to content

Instantly share code, notes, and snippets.

View jonsgold's full-sized avatar

Jonathan Goldstein jonsgold

View GitHub Profile
########################
# The index definition #
########################
NUMBER_OF_INDICES = 5
(1..NUMBER_OF_INDICES).each do |ind|
ThinkingSphinx::Index.define :incident, name: "incident_index_#{ind}", with: :active_record, delta: ThinkingSphinx::Deltas::ResqueDelta do
where "incidents.deleted = 0 AND accounts.status = 'enabled' AND (incidents.id % #{NUMBER_OF_INDICES} = #{ind - 1})"
set_property group_concat_max_len: 8192
NUMBER_OF_INDICES = 5
(1..NUMBER_OF_INDICES).each do |ind|
ThinkingSphinx::Index.define :incident, name: "incident_index_#{ind}", with: :active_record, delta: ThinkingSphinx::Deltas::ResqueDelta do
where "incidents.deleted = 0 AND accounts.status = 'enabled' AND (incidents.id % #{NUMBER_OF_INDICES} = #{ind - 1})"
set_property group_concat_max_len: 8192
indexes name, sortable: true
indexes description, number, resolution
indexes [incident_type.name, incident_sub_type.name], as: :category
ThinkingSphinx::Index.define(
:incident,
with: :active_record,
delta?: false,
delta_processor: ThinkingSphinx::Deltas.processor_for(ThinkingSphinx::Deltas::ResqueDelta)
) do
where "incidents.deleted = 0 AND accounts.status = 'enabled'"
set_property group_concat_max_len: 8192
indexes name, sortable: true