Ajoute /cite, met à jour la CI et répare les liens de vidéo
This commit is contained in:
8
index.go
8
index.go
@@ -11,7 +11,7 @@ import (
|
||||
type QuoteIndex struct {
|
||||
index bleve.Index
|
||||
Videos []Quote
|
||||
videoByKey map[string]Quote //videoByKey[youtubeKey]
|
||||
videoByPage map[string]Quote //videoByPage[youtubeKey]
|
||||
}
|
||||
|
||||
// Search search quote in index
|
||||
@@ -25,7 +25,7 @@ func (si *QuoteIndex) Search(str string) ([]Quote, error) {
|
||||
return nil, fmt.Errorf("Request error %w", err)
|
||||
}
|
||||
for _, hit := range searchResults.Hits {
|
||||
if sound, ok := si.videoByKey[hit.ID]; ok {
|
||||
if sound, ok := si.videoByPage[hit.ID]; ok {
|
||||
resp = append(resp, sound)
|
||||
}
|
||||
}
|
||||
@@ -48,10 +48,10 @@ func indexQuotes(quotes []Quote) (*QuoteIndex, error) {
|
||||
}
|
||||
|
||||
for _, quote := range quotes {
|
||||
if index.Index(quote.YoutubeKey, quote.Quote) != nil {
|
||||
if index.Index(quote.Page, quote.Quote) != nil {
|
||||
log.Printf("Error indexing %v\n", quote.Quote)
|
||||
}
|
||||
quoteMap[quote.YoutubeKey] = quote
|
||||
quoteMap[quote.Page] = quote
|
||||
}
|
||||
|
||||
return &QuoteIndex{
|
||||
|
||||
Reference in New Issue
Block a user