diff --git a/peer/cwtch_peer.go b/peer/cwtch_peer.go index eaa66a2..7a427a5 100644 --- a/peer/cwtch_peer.go +++ b/peer/cwtch_peer.go @@ -856,6 +856,12 @@ func (cp *cwtchPeer) doSearch(ctx context.Context, searchID string, pattern stri // Note: This should note be used to index a list as the ID is not expected to be tied to absolute position // in the table (e.g. deleted messages, expired messages, etc.) func (cp *cwtchPeer) SearchConversations(pattern string) string { + + // TODO: For now, we simply surround the pattern with the sqlite LIKE syntax for matching any prefix, and any suffix + // At some point we would like to extend this patternt to support e.g. searching a specific conversation, or + // searching for particular types of message. + pattern = fmt.Sprintf("%%%v%%", pattern) + // we need this lock here to prevent weirdness happening when reassigning cp.cancelSearchContext cp.mutex.Lock() defer cp.mutex.Unlock() diff --git a/testing/filesharing/file_sharing_integration_test.go b/testing/filesharing/file_sharing_integration_test.go index bdaf7a0..82ee983 100644 --- a/testing/filesharing/file_sharing_integration_test.go +++ b/testing/filesharing/file_sharing_integration_test.go @@ -166,7 +166,7 @@ func TestFileSharing(t *testing.T) { // Wait for the messages to arrive... time.Sleep(time.Second * 20) - alice.SearchConversations("%test%") + alice.SearchConversations("test") results := 0 for {