Skip to content
This repository has been archived by the owner on Apr 5, 2021. It is now read-only.

Update autocomplete ES filters and use whitespace tokenizer #9

Merged
merged 1 commit into from
Sep 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 35 additions & 28 deletions lib/data_magic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,37 +193,44 @@ def self.create_index(es_index_name = nil, field_types={})

def self.base_index_hash(es_index_name, es_types)
{
index: es_index_name,
body: {
settings: {
analysis: {
filter: {
autocomplete_filter: {
type: 'edge_ngram',
min_gram: 3,
max_gram: 25
}
index: es_index_name,
body: {
settings: {
analysis: {
filter: {
autocomplete_filter: {
type: 'edge_ngram',
min_gram: 1,
max_gram: 25,
},
autocomplete_word_delimiter: {
type: 'word_delimiter',
preserve_original: true,
split_on_case_change:false,
split_on_numerics: false,
stem_english_possessive:false
}
},
analyzer: {
autocomplete_index: {
tokenizer: 'whitespace',
filter: ['lowercase', 'autocomplete_word_delimiter', 'autocomplete_filter'],
type: 'custom'
},
autocomplete_search: {
tokenizer: 'whitespace',
filter: ['lowercase','autocomplete_word_delimiter'],
type: 'custom'
}
}
}
},
analyzer: {
autocomplete_index: {
tokenizer: 'standard',
filter: ['lowercase', 'stop', 'autocomplete_filter'],
type: 'custom'
},
autocomplete_search: {
tokenizer: 'standard',
filter: ['lowercase', 'stop'],
type: 'custom'
}
mappings: {
document: { # type 'document' is always used for external indexed docs
properties: es_types
}
}
}
},
mappings: {
document: { # type 'document' is always used for external indexed docs
properties: es_types
}
}
}
}
end

Expand Down