Add RowIndex field to search results for more efficient UI searching
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
b27229091a
commit
9dbc398690
|
@ -276,6 +276,7 @@ const (
|
||||||
EventID = Field("EventID")
|
EventID = Field("EventID")
|
||||||
EventContext = Field("EventContext")
|
EventContext = Field("EventContext")
|
||||||
Index = Field("Index")
|
Index = Field("Index")
|
||||||
|
RowIndex = Field("RowIndex")
|
||||||
ContentHash = Field("ContentHash")
|
ContentHash = Field("ContentHash")
|
||||||
|
|
||||||
// Handle denotes a contact handle of any type.
|
// Handle denotes a contact handle of any type.
|
||||||
|
|
|
@ -844,7 +844,8 @@ func (cp *cwtchPeer) doSearch(ctx context.Context, searchID string, pattern stri
|
||||||
}
|
}
|
||||||
for _, matchingMessage := range matchingMessages {
|
for _, matchingMessage := range matchingMessages {
|
||||||
// publish this search result...
|
// publish this search result...
|
||||||
cp.PublishEvent(event.NewEvent(event.SearchResult, map[event.Field]string{event.SearchID: searchID, event.ConversationID: strconv.Itoa(conversation.ID), event.Index: strconv.Itoa(matchingMessage.ID)}))
|
index, _ := cp.storage.GetRowNumberByMessageID(conversation.ID, 0, matchingMessage.ID)
|
||||||
|
cp.PublishEvent(event.NewEvent(event.SearchResult, map[event.Field]string{event.SearchID: searchID, event.RowIndex: strconv.Itoa(index), event.ConversationID: strconv.Itoa(conversation.ID), event.Index: strconv.Itoa(matchingMessage.ID)}))
|
||||||
log.Debugf("found matching message: %q", matchingMessage)
|
log.Debugf("found matching message: %q", matchingMessage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue