diff options
Diffstat (limited to 'search')
| -rw-r--r-- | search/search.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/search/search.go b/search/search.go index ced94b7..f0b1cce 100644 --- a/search/search.go +++ b/search/search.go @@ -21,7 +21,7 @@ func Search(idx *index.InvertedIndex, query string) []string { return nil } - intersection := make([]int, len(baseIDs)) + intersection := make([]index.Posting, len(baseIDs)) copy(intersection, baseIDs) for i := 1; i < len(tokenizedQuery); i++ { @@ -34,12 +34,12 @@ func Search(idx *index.InvertedIndex, query string) []string { lookup := make(map[int]struct{}) for _, id := range nextIDs { - lookup[id] = struct{}{} + lookup[id.DocId] = struct{}{} } - var filtered []int + var filtered []index.Posting for _, id := range intersection { - if _, found := lookup[id]; found { + if _, found := lookup[id.DocId]; found { filtered = append(filtered, id) } } @@ -49,7 +49,7 @@ func Search(idx *index.InvertedIndex, query string) []string { } var results []string for _, id := range intersection { - if title, exists := idx.DocNames[id]; exists { + if title, exists := idx.DocNames[id.DocId]; exists { results = append(results, title) } } |
