diff options
author | Paul Duncan <pabs@pablotron.org> | 2022-02-20 12:06:43 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2022-02-20 12:06:43 -0500 |
commit | 87c0c8d7ed4eb334dbd084d0ab0040589071b111 (patch) | |
tree | 269849b568fa5e27847af26c2ddf12e6bc36a815 /dbstore/sql/feed | |
parent | 14dc55d984a9791aeb7d242427a3d54f879f678c (diff) | |
download | cvez-87c0c8d7ed4eb334dbd084d0ab0040589071b111.tar.bz2 cvez-87c0c8d7ed4eb334dbd084d0ab0040589071b111.zip |
dbstore: shrink CVE FTS index (test index from 120M to 86M) by removing all IDs except cve_id, concatenating reference tags, and removing severities
Diffstat (limited to 'dbstore/sql/feed')
-rw-r--r-- | dbstore/sql/feed/search.sql | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/dbstore/sql/feed/search.sql b/dbstore/sql/feed/search.sql index cb80470..bc3f946 100644 --- a/dbstore/sql/feed/search.sql +++ b/dbstore/sql/feed/search.sql @@ -2,10 +2,10 @@ -- FIXME: should this be moved to cve/search SELECT COALESCE(json_group_array(json_object( 'cve_id', b.cve_id, - 'nvd_cve_id', printf('CVE-%4d-%04d', b.cve_year, b.cve_num), - 'description', d.value, - 'v3_base_score', e.v3_base_score / 10.0, - 'v3_severity', f.name, + 'nvd_id', c.nvd_id, + 'description', e.value, + 'v3_base_score', f.v3_base_score / 10.0, + 'v3_severity', g.name, 'rank', a.min_rank )), '[]') @@ -18,15 +18,17 @@ SELECT COALESCE(json_group_array(json_object( ) a JOIN cves b ON (b.cve_id = a.cve_id) - JOIN cve_descriptions c + JOIN cve_nvd_ids c ON (c.cve_id = b.cve_id) - JOIN descriptions d - ON (d.desc_id = c.desc_id) - JOIN item_cvss_v3_impacts e - ON (e.item_id = b.item_id) - JOIN severities f - ON (f.severity_id = e.v3_severity_id) + JOIN cve_descriptions d + ON (d.cve_id = b.cve_id) + JOIN descriptions e + ON (e.desc_id = d.desc_id) + JOIN item_cvss_v3_impacts f + ON (f.item_id = b.item_id) + JOIN severities g + ON (g.severity_id = f.v3_severity_id) - WHERE d.lang = 'en' + WHERE e.lang LIKE 'en%' ORDER BY a.min_rank; |