Module: ENAnalyzer

Extended by:
MultiDataset
Included in:
Data, IndexManager
Defined in:
app/analyzers/en_analyzer.rb

Class Method Summary collapse

Methods included from MultiDataset

create_all_models, create_model, dataspecs_by_name, get_all_facets, get_all_field_info, get_all_searchable_fields, get_all_truncated_fields, get_dataspec, get_model, loadAllDatasets, load_everything, run_all, use_all_or_some

Methods included from GeneralUtils

#genLink, #getHR, #get_date_index, #get_search_param, #paramMatch?

Methods included from MiscProcess

#gen_class_name, #make_facet_version, #process_pic, #set_name

Class Method Details

.analyzerSettingsObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
45
46
47
48
49
50
# File 'app/analyzers/en_analyzer.rb', line 4

def self.analyzerSettings
  # Current LIMITATION: Takes synonym list from first dataspec- maybe pass in dataspec instead?
  
  # Load dataspecs but don't load all- that ends in an infinite loop
  @instance = InstanceSpec.new
  loadAllDatasets

  # Settings
  return {
    index: {
      analysis: {
        filter: {
          english_stop: {
            type: 'stop',
            stopwords: '_english_'
          },
          english_stemmer: {
            type: 'stemmer',
            language: 'english'
          },
          english_possessive_stemmer: {
            type: 'stemmer',
            language: 'possessive_english'
          },
          synonyms: {
            type: 'synonym',
            synonyms: File.read(@dataspecs[0].synonym_list).split("\n")
          }
        },       
        analyzer: {
          custom_en_analyzer: {
          type: 'custom',
          tokenizer: 'standard',
          filter: [
                   "english_possessive_stemmer",
                   "lowercase",
                   "synonyms",
                   "english_stop",
                   "english_stemmer",
                   "asciifolding"
                  ]
          },
        },
      },
    },
  }.freeze
end