Skip to content

Instantly share code, notes, and snippets.

@karasugawasu
Last active April 12, 2018 11:32
Show Gist options
  • Save karasugawasu/58c7a4e6f39b97e7129c35e0b52764bf to your computer and use it in GitHub Desktop.
Save karasugawasu/58c7a4e6f39b97e7129c35e0b52764bf to your computer and use it in GitHub Desktop.
Mastodon Kuromoji
# app/controllers/api/v1/search_controller.rb
RESULTS_LIMIT = 50
# app/chewy/statuses_index.rb
class StatusesIndex < Chewy::Index
settings index: { refresh_interval: '15m' }, analysis: {
tokenizer: {
kuromoji_user_dict: {
type: 'kuromoji_neologd_tokenizer',
user_dictionary: 'userdic.txt',
},
},
analyzer: {
content: {
type: 'custom',
tokenizer: 'kuromoji_neologd_tokenizer',
filter: %w(
kuromoji_neologd_baseform
kuromoji_neologd_stemmer
cjk_width
lowercase
),
},
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment