class Tagliani::Configuration::Schema

Public Class Methods

new() click to toggle source
# File lib/tagliani/configuration/schema.rb, line 4
def initialize
  self.default = whiteseparated_tags
end

Private Instance Methods

analysis_settings() click to toggle source
# File lib/tagliani/configuration/schema.rb, line 10
def analysis_settings
  {
    analysis: {
      analyzer: {
        gossipAnalyzer: {
          type: 'custom',
          tokenizer: 'whitespace',
          char_filter: %w[dot_remover coma_separator],
          filter: ['lowercase']
        }
      },
      char_filter: {
        dot_remover: {
          type: 'pattern_replace',
          pattern: '\.',
          replacement: ''
        },
        coma_separator: {
          type: 'pattern_replace',
          pattern: '\,',
          replacement: ' '
        }
      }
    }
  }
end
whiteseparated_tags() click to toggle source
# File lib/tagliani/configuration/schema.rb, line 37
def whiteseparated_tags
  {
    settings: analysis_settings,
    mappings: {
      doc: {
        properties: {
          query: { type: 'percolator' },
          object_kls: {
            type: 'keyword',
            index: true
          },
          object_id: { type: 'integer' },
          created_at: { type: 'date', format: 'yyyy-MM-dd HH:mm:ss' },
          updated_at: { type: 'date', format: 'yyyy-MM-dd HH:mm:ss' },
          tag_id: { type: 'integer' },
          tag_kls: { type: 'keyword', index: true },
          tag_name: {
            type: 'text',
            analyzer: 'gossipAnalyzer'
          }
        }
      }
    }
  }
end