Sha256: 2e58a13950008c5ac33e95bf236e3e4922b2dfc62c1d8f93c24e88afcb4c7da0

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

module Riddle
  class Configuration
    class RealtimeIndex < Riddle::Configuration::Section
      include Riddle::Configuration::IndexSettings

      def self.settings
        Riddle::Configuration::IndexSettings.settings + [
          :rt_mem_limit, :rt_field, :rt_attr_uint, :rt_attr_bigint,
          :rt_attr_float, :rt_attr_timestamp, :rt_attr_string, :rt_attr_multi,
          :rt_attr_multi_64
        ]
      end

      attr_accessor :rt_mem_limit, :rt_field, :rt_attr_uint, :rt_attr_bigint,
        :rt_attr_float, :rt_attr_timestamp, :rt_attr_string, :rt_attr_multi,
        :rt_attr_multi_64

      def initialize(name)
        @name               = name
        @rt_field           = []
        @rt_attr_uint       = []
        @rt_attr_bigint     = []
        @rt_attr_float      = []
        @rt_attr_timestamp  = []
        @rt_attr_string     = []
        @rt_attr_multi      = []
        @rt_attr_multi_64   = []

        initialize_settings
      end

      def type
        "rt"
      end

      def valid?
        !(@name.nil? || @path.nil?)
      end

      def render
        raise ConfigurationError unless valid?

        (
          ["index #{name}", "{"] +
          settings_body +
          ["}", ""]
        ).join("\n")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
riddle-1.5.8 lib/riddle/configuration/realtime_index.rb
riddle-1.5.7 lib/riddle/configuration/realtime_index.rb