aboutsummaryrefslogtreecommitdiff
path: root/dbstore/dbstore.go
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2022-03-19 03:49:48 -0400
committerPaul Duncan <pabs@pablotron.org>2022-03-19 03:49:48 -0400
commit169678198051c4195579bbd011476233983fda66 (patch)
tree690833dc970d055fdaa3124b554bc81be7d636a8 /dbstore/dbstore.go
parent122ca3016cdc12ff61b2c2e2edd8df9cf2a17dc4 (diff)
downloadcvez-169678198051c4195579bbd011476233983fda66.tar.bz2
cvez-169678198051c4195579bbd011476233983fda66.zip
dbstore: lots of small fixes
Diffstat (limited to 'dbstore/dbstore.go')
-rw-r--r--dbstore/dbstore.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/dbstore/dbstore.go b/dbstore/dbstore.go
index a80aea6..65aa359 100644
--- a/dbstore/dbstore.go
+++ b/dbstore/dbstore.go
@@ -176,6 +176,13 @@ var addCpeDictionaryQueryIds = []string {
"cpe/insert",
"cpe/insert-title",
"cpe/insert-ref",
+ "cpe/insert-fts-refresh",
+}
+
+// Refresh CVE FTS index.
+func (me DbStore) refreshCpeFts(ctx context.Context, tx Tx) error {
+ _, err := tx.Exec(ctx, "cpe/insert-fts-refresh")
+ return err
}
// import CPE dictionary
@@ -217,8 +224,8 @@ func (me DbStore) AddCpeDictionary(ctx context.Context, dict cpedict.Dictionary)
}
}
- // return success
- return nil
+ // refresh the cpe fts's
+ return me.refreshCpeFts(ctx, tx)
})
}
@@ -325,7 +332,7 @@ func (me DbStore) AddCpeMatches(ctx context.Context, matches cpematch.Matches) e
// add names
for _, name := range(m.Names) {
- _, err := tx.Exec(ctx, "cpe-match/insert-name", id, name.Cpe23Uri, name.Cpe22Uri)
+ _, err := tx.Exec(ctx, "cpe-match/insert-name", id, name.Cpe22Uri, name.Cpe23Uri)
if err != nil {
return err
}