Skip to content

Commit

Permalink
Create mappings for ArtistRepository and AlbumRepository
Browse files Browse the repository at this point in the history
  • Loading branch information
estolfo committed Sep 10, 2018
1 parent bbd1383 commit 178770f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/repositories/album_repository.rb
Expand Up @@ -4,4 +4,18 @@ class AlbumRepository

index_name 'albums'
klass Album

mapping do
indexes :label, { type: 'object' }
indexes :title
indexes :notes
indexes :tracklist_combined, { analyzer: 'snowball' }
indexes :album_suggest, {
type: 'object',
properties: {
title: { type: 'completion' },
tracklist: { type: 'completion' }
}
}
end
end
19 changes: 19 additions & 0 deletions app/repositories/artist_repository.rb
Expand Up @@ -4,4 +4,23 @@ class ArtistRepository

index_name 'artists'
klass Artist

analyzed_and_raw = { fields: {
name: { type: 'text', analyzer: 'snowball' },
raw: { type: 'keyword' }
} }

mapping do
indexes :name, analyzed_and_raw
indexes :members, analyzed_and_raw
indexes :profile
indexes :members_combined, { analyzer: 'snowball' }
indexes :artist_suggest, {
type: 'object',
properties: {
name: { type: 'completion' },
members: { type: 'completion' }
}
}
end
end

0 comments on commit 178770f

Please sign in to comment.