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.
156 157 158 |
# File 'lib/fluent/plugin/out_groonga.rb', line 156 def initialize(raw) @raw = raw end |
Instance Method Details
#default_tokenizer ⇒ Object
172 173 174 |
# File 'lib/fluent/plugin/out_groonga.rb', line 172 def default_tokenizer @raw[:default_tokenizer] end |
#flags ⇒ Object
164 165 166 |
# File 'lib/fluent/plugin/out_groonga.rb', line 164 def flags parse_flags(@raw[:flags] || "TABLE_NO_KEY") end |
#have_difference?(table) ⇒ Boolean
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/fluent/plugin/out_groonga.rb', line 190 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
184 185 186 187 188 |
# File 'lib/fluent/plugin/out_groonga.rb', line 184 def indexes (@raw[:indexes] || []).collect do |raw| IndexDefinition.new(self, raw) end end |
#key_type ⇒ Object
168 169 170 |
# File 'lib/fluent/plugin/out_groonga.rb', line 168 def key_type @raw[:key_type] end |
#name ⇒ Object
160 161 162 |
# File 'lib/fluent/plugin/out_groonga.rb', line 160 def name @raw[:name] end |
#normalizer ⇒ Object
180 181 182 |
# File 'lib/fluent/plugin/out_groonga.rb', line 180 def normalizer @raw[:normalizer] end |
#to_create_arguments ⇒ Object
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/fluent/plugin/out_groonga.rb', line 208 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
176 177 178 |
# File 'lib/fluent/plugin/out_groonga.rb', line 176 def token_filters parse_items(@raw[:token_filters] || "") end |