Class: Fluent::GroongaOutput::TableDefinition
- Inherits:
-
Object
- Object
- Fluent::GroongaOutput::TableDefinition
- Includes:
- DefinitionParseMethods
- Defined in:
- lib/fluent/plugin/out_groonga.rb
Defined Under Namespace
Classes: IndexDefinition
Instance Method Summary (collapse)
- - (Object) default_tokenizer
- - (Object) flags
- - (Boolean) have_difference?(table)
- - (Object) indexes
-
- (TableDefinition) initialize(raw)
constructor
A new instance of TableDefinition.
- - (Object) key_type
- - (Object) name
- - (Object) normalizer
- - (Object) to_create_arguments
- - (Object) token_filters
Constructor Details
- (TableDefinition) initialize(raw)
Returns a new instance of TableDefinition
147 148 149 |
# File 'lib/fluent/plugin/out_groonga.rb', line 147 def initialize(raw) @raw = raw end |
Instance Method Details
- (Object) default_tokenizer
163 164 165 |
# File 'lib/fluent/plugin/out_groonga.rb', line 163 def default_tokenizer @raw[:default_tokenizer] end |
- (Object) flags
155 156 157 |
# File 'lib/fluent/plugin/out_groonga.rb', line 155 def flags parse_flags(@raw[:flags] || "TABLE_NO_KEY") end |
- (Boolean) have_difference?(table)
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/fluent/plugin/out_groonga.rb', line 181 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 |
- (Object) indexes
175 176 177 178 179 |
# File 'lib/fluent/plugin/out_groonga.rb', line 175 def indexes (@raw[:indexes] || []).collect do |raw| IndexDefinition.new(self, raw) end end |
- (Object) key_type
159 160 161 |
# File 'lib/fluent/plugin/out_groonga.rb', line 159 def key_type @raw[:key_type] end |
- (Object) name
151 152 153 |
# File 'lib/fluent/plugin/out_groonga.rb', line 151 def name @raw[:name] end |
- (Object) normalizer
171 172 173 |
# File 'lib/fluent/plugin/out_groonga.rb', line 171 def normalizer @raw[:normalizer] end |
- (Object) to_create_arguments
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/fluent/plugin/out_groonga.rb', line 199 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 |
- (Object) token_filters
167 168 169 |
# File 'lib/fluent/plugin/out_groonga.rb', line 167 def token_filters parse_items(@raw[:token_filters] || "") end |