eksterd: add channel to search results
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
cb6bf8fc05
commit
b4cc885103
|
@ -606,9 +606,9 @@ func (b *memoryBackend) channelAddItemWithMatcher(channel string, item microsub.
|
||||||
// if regex matches item
|
// if regex matches item
|
||||||
// - add item to channel
|
// - add item to channel
|
||||||
|
|
||||||
err := addToSearch(item)
|
err := addToSearch(item, channel)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("in channelAddItemWithMatcher: %v", err)
|
return fmt.Errorf("addToSearch in channelAddItemWithMatcher: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var updatedChannels []string
|
var updatedChannels []string
|
||||||
|
|
|
@ -27,10 +27,16 @@ func initSearch() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func addToSearch(item microsub.Item) error {
|
type indexItem struct {
|
||||||
|
microsub.Item
|
||||||
|
Channel string `json:"channel"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func addToSearch(item microsub.Item, channel string) error {
|
||||||
// TODO: add channel when indexing
|
// TODO: add channel when indexing
|
||||||
if index != nil {
|
if index != nil {
|
||||||
err := index.Index(item.ID, item)
|
indexItem := indexItem{item, channel}
|
||||||
|
err := index.Index(item.ID, indexItem)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("while indexing item: %v", err)
|
return fmt.Errorf("while indexing item: %v", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user