Add tags to indices for searching

This commit is contained in:
2022-06-04 11:03:26 +09:30
parent 4cac81aab0
commit 2ba4066643
3 changed files with 50 additions and 3 deletions

View File

@@ -131,8 +131,6 @@ func (m *BookmarkManager) Search(query string) ([]entity.Bookmark, error) {
}
}
// log.Printf("counts: %#v", counts)
for k, v := range counts {
if v == uint8(len(words)) {
rets = append(rets, k)
@@ -157,6 +155,7 @@ func (m *BookmarkManager) ScrapeAndIndex(bm *entity.Bookmark) error {
}
words := content.Words(bm)
words = append(words, bm.Tags...)
log.Printf("index for %d %s (%d words)", bm.ID, bm.URL, len(words))
m.db.UpdateIndexForWordsByID(words, bm.ID)