diff options
Diffstat (limited to 'dbstore/dbstore.go')
-rw-r--r-- | dbstore/dbstore.go | 13 |
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 } |