aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlec Warner <antarus@gentoo.org>2018-01-20 15:44:12 -0500
committerAlec Warner <antarus@gentoo.org>2018-01-20 15:44:12 -0500
commit9edd781c9a00bf3b0c1dbe66cb3f30939a584b5f (patch)
treeec159a55b89cc1dd08670f274be7fb4037bb1e72 /app
parentTurn category names back into keywords. (diff)
downloadpackages-9edd781c9a00bf3b0c1dbe66cb3f30939a584b5f.tar.gz
packages-9edd781c9a00bf3b0c1dbe66cb3f30939a584b5f.tar.bz2
packages-9edd781c9a00bf3b0c1dbe66cb3f30939a584b5f.zip
Convert more fields to keyword mapping.
In previous changes I over-eagerly converted string fields to text. Note in package.rb most of them were already 'keyword'. This cause the package indices to work well, but the other indices were failing to work properly. By default, try to keyword index all fields. This should provide similar matching as before. Fulltext index description fields.
Diffstat (limited to 'app')
-rw-r--r--app/models/change.rb10
-rw-r--r--app/models/package.rb4
-rw-r--r--app/models/useflag.rb8
-rw-r--r--app/models/version.rb24
4 files changed, 23 insertions, 23 deletions
diff --git a/app/models/change.rb b/app/models/change.rb
index 9ad8e70..580d5ab 100644
--- a/app/models/change.rb
+++ b/app/models/change.rb
@@ -4,10 +4,10 @@ class Change
index_name "changes-#{Rails.env}"
- attribute :package, String, mapping: { type: 'text' }
- attribute :category, String, mapping: { type: 'text' }
- attribute :change_type, String, mapping: { type: 'text' }
- attribute :version, String, mapping: { type: 'text' }
- attribute :arches, String, mapping: { type: 'text' }
+ 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 ea67f6e..dd63622 100644
--- a/app/models/package.rb
+++ b/app/models/package.rb
@@ -14,8 +14,8 @@ class Package
attribute :name, String, mapping: raw_fields
attribute :name_sort, String, mapping: raw_fields
attribute :atom, String, mapping: raw_fields
- attribute :description, String, mapping: raw_fields
- attribute :longdescription, 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
diff --git a/app/models/useflag.rb b/app/models/useflag.rb
index 65a7ecd..131a89c 100644
--- a/app/models/useflag.rb
+++ b/app/models/useflag.rb
@@ -4,11 +4,11 @@ class Useflag
index_name "useflags-#{Rails.env}"
- attribute :name, String, mapping: { type: 'text' }
+ attribute :name, String, mapping: { type: 'keyword' }
attribute :description, String, mapping: { type: 'text' }
- attribute :atom, String, mapping: { type: 'text' }
- attribute :scope, String, mapping: { type: 'text' }
- attribute :use_expand_prefix, 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 50d3940..a457c2c 100644
--- a/app/models/version.rb
+++ b/app/models/version.rb
@@ -5,19 +5,19 @@ class Version
index_name "versions-#{Rails.env}"
- attribute :version, String, mapping: { type: 'text' }
- attribute :package, String, mapping: { type: 'text' }
- attribute :atom, String, mapping: { type: 'text' }
- attribute :sort_key, Integer, mapping: { type: 'text' }
- attribute :slot, String, mapping: { type: 'text' }
- attribute :subslot, String, mapping: { type: 'text' }
- attribute :eapi, String, mapping: { type: 'text' }
- attribute :keywords, String, mapping: { type: 'text' }
+ 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: { type: 'text' }
- attribute :restrict, String, default: [], mapping: { type: 'text' }
- attribute :properties, String, default: [], mapping: { type: 'text' }
- attribute :metadata_hash, String, mapping: { type: 'text' }
+ 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
#