From 2868805c2d6faca4b391fef6699b5cc5826ac9c5 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Fri, 22 May 2020 00:41:42 +0200 Subject: [PATCH] Add top-level attrset to package documents (#37) --- scripts/import-channels-into-elasticsearch | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/import-channels-into-elasticsearch b/scripts/import-channels-into-elasticsearch index 1a0158d..71aa783 100755 --- a/scripts/import-channels-into-elasticsearch +++ b/scripts/import-channels-into-elasticsearch @@ -133,9 +133,17 @@ def get_packages(evaluation): or None for platform in data["meta"].get("platforms", []) ] - yield dict( + + attr_set = None + if "." in attr_name: + attr_set = attr_name.split(".")[0] + if not attr_set.endswith("Packages") and not attr_set.endswith("Plugins"): + attr_set = None + + doc = dict( id=attr_name, attr_name=attr_name, + attr_set=attr_set, pname=data["pname"], pversion=data["version"], description=data["meta"].get("description"), @@ -146,6 +154,7 @@ def get_packages(evaluation): position=position, homepage=data["meta"].get("homepage"), ) + yield doc return len(packages), gen @@ -202,8 +211,9 @@ def recreate_index(es, channel): } }, ), + attr_set=dict(type="keyword"), pname=dict(type="keyword"), - pversion=dict(type="text"), + pversion=dict(type="keyword"), description=dict(type="text"), longDescription=dict(type="text"), license=dict(