aboutsummaryrefslogtreecommitdiff
path: root/libbrep
diff options
context:
space:
mode:
Diffstat (limited to 'libbrep')
-rw-r--r--libbrep/package.cxx35
-rw-r--r--libbrep/package.hxx22
-rw-r--r--libbrep/package.xml90
3 files changed, 127 insertions, 20 deletions
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<string> ds,
optional<text_type> 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<string>
- // 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<string> 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<string> description,
optional<text_type> 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<string> description; // Absent if type is unknown.
optional<text_type> 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 @@
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" schema-name="package" version="1">
+ <changeset version="14">
+ <add-table name="package_topics" kind="container">
+ <column name="tenant" type="TEXT" null="false"/>
+ <column name="name" type="CITEXT" null="false"/>
+ <column name="version_epoch" type="INTEGER" null="false"/>
+ <column name="version_canonical_upstream" type="TEXT" null="false"/>
+ <column name="version_canonical_release" type="TEXT" null="false" options="COLLATE &quot;C&quot;"/>
+ <column name="version_revision" type="INTEGER" null="false"/>
+ <column name="index" type="BIGINT" null="false"/>
+ <column name="topic" type="TEXT" null="false"/>
+ <foreign-key name="tenant_fk" deferrable="DEFERRED">
+ <column name="tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <foreign-key name="object_id_fk" on-delete="CASCADE">
+ <column name="tenant"/>
+ <column name="name"/>
+ <column name="version_epoch"/>
+ <column name="version_canonical_upstream"/>
+ <column name="version_canonical_release"/>
+ <column name="version_revision"/>
+ <references table="package">
+ <column name="tenant"/>
+ <column name="name"/>
+ <column name="version_epoch"/>
+ <column name="version_canonical_upstream"/>
+ <column name="version_canonical_release"/>
+ <column name="version_revision"/>
+ </references>
+ </foreign-key>
+ <index name="package_topics_object_id_i">
+ <column name="tenant"/>
+ <column name="name"/>
+ <column name="version_epoch"/>
+ <column name="version_canonical_upstream"/>
+ <column name="version_canonical_release"/>
+ <column name="version_revision"/>
+ </index>
+ <index name="package_topics_index_i">
+ <column name="index"/>
+ </index>
+ </add-table>
+ <add-table name="package_keywords" kind="container">
+ <column name="tenant" type="TEXT" null="false"/>
+ <column name="name" type="CITEXT" null="false"/>
+ <column name="version_epoch" type="INTEGER" null="false"/>
+ <column name="version_canonical_upstream" type="TEXT" null="false"/>
+ <column name="version_canonical_release" type="TEXT" null="false" options="COLLATE &quot;C&quot;"/>
+ <column name="version_revision" type="INTEGER" null="false"/>
+ <column name="index" type="BIGINT" null="false"/>
+ <column name="keyword" type="TEXT" null="false"/>
+ <foreign-key name="tenant_fk" deferrable="DEFERRED">
+ <column name="tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <foreign-key name="object_id_fk" on-delete="CASCADE">
+ <column name="tenant"/>
+ <column name="name"/>
+ <column name="version_epoch"/>
+ <column name="version_canonical_upstream"/>
+ <column name="version_canonical_release"/>
+ <column name="version_revision"/>
+ <references table="package">
+ <column name="tenant"/>
+ <column name="name"/>
+ <column name="version_epoch"/>
+ <column name="version_canonical_upstream"/>
+ <column name="version_canonical_release"/>
+ <column name="version_revision"/>
+ </references>
+ </foreign-key>
+ <index name="package_keywords_object_id_i">
+ <column name="tenant"/>
+ <column name="name"/>
+ <column name="version_epoch"/>
+ <column name="version_canonical_upstream"/>
+ <column name="version_canonical_release"/>
+ <column name="version_revision"/>
+ </index>
+ <index name="package_keywords_index_i">
+ <column name="index"/>
+ </index>
+ </add-table>
+ <drop-table name="package_tags"/>
+ </changeset>
+
<changeset version="13">
<alter-table name="package">
<add-column name="upstream_version" type="TEXT" null="true"/>