Module: Lcms::Engine::Search

Defined in:
app/models/lcms/engine/search/document.rb,
app/models/lcms/engine/search/repository.rb,
app/models/lcms/engine/search/elastic_search_document.rb

Defined Under Namespace

Classes: Document, ElasticSearchDocument, Repository

Class Method Summary collapse

Class Method Details

.index_settingsObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/models/lcms/engine/search/repository.rb', line 18

def self.index_settings
  {
    analysis: {
      filter: {
        str_ngrams: { type: 'nGram', min_gram: 3, max_gram: 10 },
        stop_en: { type: 'stop', stopwords: '_english_' }
      },
      analyzer: {
        keyword_str: {
          filter: ['lowercase'],
          type: 'custom',
          tokenizer: 'keyword'
        },
        full_str: {
          filter: %w(standard lowercase stop_en asciifolding),
          type: 'custom',
          tokenizer: 'standard'
        },
        partial_str: {
          filter: %w(standard lowercase stop_en asciifolding str_ngrams),
          type: 'custom',
          tokenizer: 'standard'
        }
      }
    }
  }
end

.ngrams_multi_fieldObject



8
9
10
11
12
13
14
15
16
# File 'app/models/lcms/engine/search/repository.rb', line 8

def self.ngrams_multi_field
  {
    type: 'string', fields: {
      full: { type: 'string', analyzer: 'full_str' },
      partial: { type: 'string', analyzer: 'partial_str' },
      key: { type: 'string', index: 'not_analyzed' }
    }
  }
end