Skip to content

Instantly share code, notes, and snippets.

@mschoch
Created April 20, 2017 21:52
Show Gist options
  • Save mschoch/9dad311c89647d5bb4bb39049a43a7fa to your computer and use it in GitHub Desktop.
Save mschoch/9dad311c89647d5bb4bb39049a43a7fa to your computer and use it in GitHub Desktop.
err = indexMapping.AddCustomTokenMap("myStopWords", map[string]interface{}{
"tokens": []interface{}{"a", "in", "the"},
})
if err != nil {
return nil, err
}
err = indexMapping.AddCustomTokenFilter("myStopFilter", map[string]interface{}{
"type": "stop_tokens",
"stop_token_map": "stop_test",
})
if err != nil {
return nil, err
}
err = indexMapping.AddCustomAnalyzer("myCustomAnalyzerWithStop",
map[string]interface{}{
"type": custom.Name,
"tokenizer": unicode.Name,
"token_filters": []string{
lowercase.Name,
"myStopFilter",
},
})
if err != nil {
return nil, err
}
indexMapping.DefaultAnalyzer = "myCustomAnalyzerWithStop"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment