From 045563bb01a3fb9de9371854cbc16b77860c221b Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 3 Jun 2019 22:56:45 +0300 Subject: Add support for topics and keywords package manifest values --- libbrep/package.cxx | 35 ++++++++++++++------- libbrep/package.hxx | 22 ++++++++----- libbrep/package.xml | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+), 20 deletions(-) (limited to 'libbrep') diff --git a/libbrep/package.cxx b/libbrep/package.cxx index 763cec9..6c6a565 100644 --- a/libbrep/package.cxx +++ b/libbrep/package.cxx @@ -57,7 +57,8 @@ namespace brep priority_type pr, string sm, license_alternatives_type la, - strings tg, + strings tp, + strings kw, optional ds, optional dt, string ch, @@ -87,7 +88,8 @@ namespace brep priority (move (pr)), summary (move (sm)), license_alternatives (move (la)), - tags (move (tg)), + topics (move (tp)), + keywords (move (kw)), description (move (ds)), description_type (move (dt)), changes (move (ch)), @@ -133,8 +135,8 @@ namespace brep if (!internal ()) return weighted_text (); - // Derive keywords from the basic package information: name, - // version. + // Derive search keywords from the basic package information: project, + // name, and version. // //@@ What about 'stable' from cppget.org/stable? Add path of // the repository to keywords? Or is it too "polluting" and @@ -149,12 +151,7 @@ namespace brep if (upstream_version) k += " " + *upstream_version; - // Add tags to keywords. - // - for (const auto& t: tags) - k += " " + t; - - // Add licenses to keywords. + // Add licenses to search keywords. // for (const auto& la: license_alternatives) { @@ -162,7 +159,7 @@ namespace brep { k += " " + l; - // If license is say LGPLv2 then LGPL is also a keyword. + // If license is say LGPLv2 then LGPL is also a search keyword. // size_t n (l.size ()); if (n > 2 && l[n - 2] == 'v' && l[n - 1] >= '0' && l[n - 1] <= '9') @@ -170,7 +167,21 @@ namespace brep } } - return {move (k), summary, description ? *description : "", changes}; + // Derive second-strongest search keywords from the package summary. + // + string k2 (summary); + + // Add topics to the second-strongest search keywords. + // + for (const auto& t: topics) + k2 += " " + t; + + // Add keywords to the second-strongest search keywords. + // + for (const auto& k: keywords) + k2 += " " + k; + + return {move (k), move (k2), description ? *description : "", changes}; } // repository diff --git a/libbrep/package.hxx b/libbrep/package.hxx index c4304f6..18cd629 100644 --- a/libbrep/package.hxx +++ b/libbrep/package.hxx @@ -21,16 +21,16 @@ // #define LIBBREP_PACKAGE_SCHEMA_VERSION_BASE 11 -#pragma db model version(LIBBREP_PACKAGE_SCHEMA_VERSION_BASE, 13, closed) +#pragma db model version(LIBBREP_PACKAGE_SCHEMA_VERSION_BASE, 14, closed) namespace brep { // @@ Might make sense to put some heavy members (e.g., description, // containers) into a separate section. // - // @@ Not sure there is a benefit in making tags a full-blown container - // (i.e., a separate table). Maybe provide a mapping of vector - // to TEXT as a comma-separated list. + // @@ Not sure there is a benefit in making topics/keywords full-blown + // containers (i.e., a separate table). Maybe provide a mapping of + // vector to TEXT as a comma/space-separated list. // // Forward declarations. @@ -366,7 +366,8 @@ namespace brep priority_type, string summary, license_alternatives_type, - strings tags, + strings topics, + strings keywords, optional description, optional description_type, string changes, @@ -418,7 +419,8 @@ namespace brep priority_type priority; string summary; license_alternatives_type license_alternatives; - strings tags; + strings topics; + strings keywords; optional description; // Absent if type is unknown. optional description_type; // Present if description is present. string changes; @@ -481,9 +483,13 @@ namespace brep set(odb::nested_set (this.license_alternatives, std::move (?))) \ id_column("") key_column("") value_column("license") - // tags + // topics // - #pragma db member(tags) id_column("") value_column("tag") + #pragma db member(topics) id_column("") value_column("topic") + + // keywords + // + #pragma db member(keywords) id_column("") value_column("keyword") // dependencies // diff --git a/libbrep/package.xml b/libbrep/package.xml index a1e7602..1a4a5b2 100644 --- a/libbrep/package.xml +++ b/libbrep/package.xml @@ -1,4 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.1