diff options
author | Alec Warner <antarus@gentoo.org> | 2018-02-18 15:25:04 -0500 |
---|---|---|
committer | Alec Warner <antarus@gentoo.org> | 2018-02-18 15:25:45 -0500 |
commit | c529287ab75f16d3b7cf2445c0122b87e9b161d1 (patch) | |
tree | e2bd8af66f7461ebdb3ea20eca84e397bfac015a /app | |
parent | REDIS_URL should use redis scheme. (diff) | |
parent | packages_search: raise result limit for USE-flag search (diff) | |
download | packages-5-c529287ab75f16d3b7cf2445c0122b87e9b161d1.tar.gz packages-5-c529287ab75f16d3b7cf2445c0122b87e9b161d1.tar.bz2 packages-5-c529287ab75f16d3b7cf2445c0122b87e9b161d1.zip |
Merge branch 'es-6-compat' into master.v6.0.0
Signed-off-by: Robin Johnson <robbat2@gentoo.org>
Collectively this contains a series of commits to move from
Elasticsearch v2.X to Elasticsearch v6.0.1. It also contains a bundler
update for the ruby environment.
Diffstat (limited to 'app')
-rw-r--r-- | app/models/category.rb | 8 | ||||
-rw-r--r-- | app/models/change.rb | 12 | ||||
-rw-r--r-- | app/models/package.rb | 28 | ||||
-rw-r--r-- | app/models/useflag.rb | 12 | ||||
-rw-r--r-- | app/models/version.rb | 28 |
5 files changed, 46 insertions, 42 deletions
diff --git a/app/models/category.rb b/app/models/category.rb index 5fa31ea..f629bde 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -2,11 +2,11 @@ class Category include Elasticsearch::Persistence::Model include Kkuleomi::Store::Model - index_name "packages-#{Rails.env}" + index_name "categories-#{Rails.env}" - attribute :name, String, mapping: { index: 'not_analyzed' } - attribute :description, String - attribute :metadata_hash, String, mapping: { index: 'not_analyzed' } + attribute :name, String, mapping: { type: 'keyword' } + attribute :description, String, mapping: { type: 'text' } + attribute :metadata_hash, String, mapping: { type: 'text' } # Determines if the document model needs an update from the repository model # diff --git a/app/models/change.rb b/app/models/change.rb index 9ffe258..6eaf00c 100644 --- a/app/models/change.rb +++ b/app/models/change.rb @@ -2,12 +2,12 @@ class Change include Elasticsearch::Persistence::Model include Kkuleomi::Store::Model - index_name "packages-#{Rails.env}" + index_name "change-#{Rails.env}" - attribute :package, String, mapping: { index: 'not_analyzed' } - attribute :category, String, mapping: { index: 'not_analyzed' } - attribute :change_type, String, mapping: { index: 'not_analyzed' } - attribute :version, String, mapping: { index: 'not_analyzed' } - attribute :arches, String, mapping: { index: 'not_analyzed' } + attribute :package, String, mapping: { type: 'keyword' } + attribute :category, String, mapping: { type: 'keyword' } + attribute :change_type, String, mapping: { type: 'keyword' } + attribute :version, String, mapping: { type: 'keyword' } + attribute :arches, String, mapping: { type: 'keyword' } attribute :commit, Hash, default: {}, mapping: { type: 'object' } end diff --git a/app/models/package.rb b/app/models/package.rb index 24cbd8b..7ad3cbe 100644 --- a/app/models/package.rb +++ b/app/models/package.rb @@ -6,19 +6,23 @@ class Package index_name "packages-#{Rails.env}" - attribute :category, String, mapping: { index: 'not_analyzed' } - attribute :name, String, mapping: { index: 'not_analyzed' } - attribute :name_sort, String, mapping: { index: 'not_analyzed' } - attribute :atom, String, mapping: { index: 'not_analyzed' } - attribute :description, String - attribute :longdescription, String - attribute :homepage, String, default: [], mapping: { index: 'not_analyzed' } - attribute :license, String, mapping: { index: 'not_analyzed' } - attribute :licenses, String, default: [], mapping: { index: 'not_analyzed' } - attribute :herds, String, default: [], mapping: { index: 'not_analyzed' } + raw_fields = { + type: 'keyword' + } + + attribute :category, String, mapping: raw_fields + attribute :name, String, mapping: raw_fields + attribute :name_sort, String, mapping: raw_fields + attribute :atom, String, mapping: raw_fields + attribute :description, String, mapping: { type: 'text' } + attribute :longdescription, String, mapping: { type: 'text' } + attribute :homepage, String, default: [], mapping: raw_fields + attribute :license, String, mapping: raw_fields + attribute :licenses, String, default: [], mapping: raw_fields + attribute :herds, String, default: [], mapping: raw_fields attribute :maintainers, Array, default: [], mapping: { type: 'object' } attribute :useflags, Hash, default: {}, mapping: { type: 'object' } - attribute :metadata_hash, String, mapping: { index: 'not_analyzed' } + attribute :metadata_hash, String, mapping: raw_fields def category_model @category_model ||= Category.find_by(:name, category) @@ -40,7 +44,7 @@ class Package end def versions - @versions ||= Version.find_all_by_parent(self, sort: { sort_key: { order: 'asc' } }) + @versions ||= Version.find_all_by(:package, atom, sort: { sort_key: { order: 'asc' } }) end def latest_version diff --git a/app/models/useflag.rb b/app/models/useflag.rb index 1139c97..131a89c 100644 --- a/app/models/useflag.rb +++ b/app/models/useflag.rb @@ -2,13 +2,13 @@ class Useflag include Elasticsearch::Persistence::Model include Kkuleomi::Store::Model - index_name "packages-#{Rails.env}" + index_name "useflags-#{Rails.env}" - attribute :name, String, mapping: { index: 'not_analyzed' } - attribute :description, String - attribute :atom, String, mapping: { index: 'not_analyzed' } - attribute :scope, String, mapping: { index: 'not_analyzed' } - attribute :use_expand_prefix, String, mapping: { index: 'not_analyzed' } + attribute :name, String, mapping: { type: 'keyword' } + attribute :description, String, mapping: { type: 'text' } + attribute :atom, String, mapping: { type: 'keyword' } + attribute :scope, String, mapping: { type: 'keyword' } + attribute :use_expand_prefix, String, mapping: { type: 'keyword' } def all_fields [:name, :description, :atom, :scope, :use_expand_prefix] diff --git a/app/models/version.rb b/app/models/version.rb index 1dc28f8..a457c2c 100644 --- a/app/models/version.rb +++ b/app/models/version.rb @@ -3,21 +3,21 @@ class Version include Kkuleomi::Store::Model include Kkuleomi::Store::Models::VersionImport - index_name "packages-#{Rails.env}" - - attribute :version, String, mapping: { index: 'not_analyzed' } - attribute :package, String, mapping: { index: 'not_analyzed' } - attribute :atom, String, mapping: { index: 'not_analyzed' } - attribute :sort_key, Integer, mapping: { index: 'not_analyzed' } - attribute :slot, String, mapping: { index: 'not_analyzed' } - attribute :subslot, String, mapping: { index: 'not_analyzed' } - attribute :eapi, String, mapping: { index: 'not_analyzed' } - attribute :keywords, String, mapping: { index: 'not_analyzed' } + index_name "versions-#{Rails.env}" + + attribute :version, String, mapping: { type: 'keyword' } + attribute :package, String, mapping: { type: 'keyword' } + attribute :atom, String, mapping: { type: 'keyword' } + attribute :sort_key, Integer, mapping: { type: 'keyword' } + attribute :slot, String, mapping: { type: 'keyword' } + attribute :subslot, String, mapping: { type: 'keyword' } + attribute :eapi, String, mapping: { type: 'keyword' } + attribute :keywords, String, mapping: { type: 'keyword' } attribute :masks, Array, default: [], mapping: { type: 'object' } - attribute :use, String, default: [], mapping: { index: 'not_analyzed' } - attribute :restrict, String, default: [], mapping: { index: 'not_analyzed' } - attribute :properties, String, default: [], mapping: { index: 'not_analyzed' } - attribute :metadata_hash, String, mapping: { index: 'not_analyzed' } + attribute :use, String, default: [], mapping: { type: 'keyword' } + attribute :restrict, String, default: [], mapping: { type: 'keyword' } + attribute :properties, String, default: [], mapping: { type: 'keyword' } + attribute :metadata_hash, String, mapping: { type: 'keyword' } # Returns the keywording state on a given architecture # |