Class: Fluent::Plugin::GroongaOutput::TableDefinition
- Inherits:
-
Object
- Object
- Fluent::Plugin::GroongaOutput::TableDefinition
- Includes:
- DefinitionParseMethods
- Defined in:
- lib/fluent/plugin/out_groonga.rb
Defined Under Namespace
Classes: IndexDefinition
Instance Method Summary collapse
- #default_tokenizer ⇒ Object
- #flags ⇒ Object
- #have_difference?(table) ⇒ Boolean
- #indexes ⇒ Object
-
#initialize(raw) ⇒ TableDefinition
constructor
A new instance of TableDefinition.
- #key_type ⇒ Object
- #name ⇒ Object
- #normalizer ⇒ Object
- #to_create_arguments ⇒ Object
- #token_filters ⇒ Object
Constructor Details
#initialize(raw) ⇒ TableDefinition
Returns a new instance of TableDefinition.
151 152 153 |
# File 'lib/fluent/plugin/out_groonga.rb', line 151 def initialize(raw) @raw = raw end |
Instance Method Details
#default_tokenizer ⇒ Object
167 168 169 |
# File 'lib/fluent/plugin/out_groonga.rb', line 167 def default_tokenizer @raw[:default_tokenizer] end |
#flags ⇒ Object
159 160 161 |
# File 'lib/fluent/plugin/out_groonga.rb', line 159 def flags parse_flags(@raw[:flags] || "TABLE_NO_KEY") end |
#have_difference?(table) ⇒ Boolean
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/fluent/plugin/out_groonga.rb', line 185 def have_difference?(table) return true if table.name != name table_flags = (parse_flags(table.flags) - ["PERSISTENT"]) return true if table_flags.sort != flags.sort return true if table.domain != key_type return true if table.default_tokenizer != default_tokenizer # TODO # return true if table.token_filters.sort != token_filters.sort return true if table.normalizer != normalizer false end |
#indexes ⇒ Object
179 180 181 182 183 |
# File 'lib/fluent/plugin/out_groonga.rb', line 179 def indexes (@raw[:indexes] || []).collect do |raw| IndexDefinition.new(self, raw) end end |
#key_type ⇒ Object
163 164 165 |
# File 'lib/fluent/plugin/out_groonga.rb', line 163 def key_type @raw[:key_type] end |
#name ⇒ Object
155 156 157 |
# File 'lib/fluent/plugin/out_groonga.rb', line 155 def name @raw[:name] end |
#normalizer ⇒ Object
175 176 177 |
# File 'lib/fluent/plugin/out_groonga.rb', line 175 def normalizer @raw[:normalizer] end |
#to_create_arguments ⇒ Object
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/fluent/plugin/out_groonga.rb', line 203 def to_create_arguments arguments = { "name" => name, "flags" => flags.join("|"), "key_type" => key_type, "default_tokenizer" => default_tokenizer, # TODO # "token_filters" => token_filters.join("|"), "normalizer" => normalizer, } arguments.keys.each do |key| value = arguments[key] arguments.delete(key) if value.nil? or value.empty? end arguments end |
#token_filters ⇒ Object
171 172 173 |
# File 'lib/fluent/plugin/out_groonga.rb', line 171 def token_filters parse_items(@raw[:token_filters] || "") end |