From 7c2e25e25a5a2d02230b52772a874c06fe409206 Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Wed, 23 Feb 2022 15:31:06 +1100 Subject: [PATCH] remove useless code --- .../Utilities/FullTextSearchFinder.swift | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/SessionMessagingKit/Utilities/FullTextSearchFinder.swift b/SessionMessagingKit/Utilities/FullTextSearchFinder.swift index 78ea59d5d..0320aeaf2 100644 --- a/SessionMessagingKit/Utilities/FullTextSearchFinder.swift +++ b/SessionMessagingKit/Utilities/FullTextSearchFinder.swift @@ -30,8 +30,6 @@ public class FullTextSearchFinder: NSObject { private static var tsAccountManager: TSAccountManager { return TSAccountManager.sharedInstance() } - - public var newQueryTimestamp: UInt64 = 0 // MARK: - Querying @@ -91,13 +89,6 @@ public class FullTextSearchFinder: NSObject { guard let ext: YapDatabaseFullTextSearchTransaction = ext(transaction: transaction) else { return } - - // HACK: Full text search is too expensive even though we drop the max search results - // to a reasonable number. And the async read can sometimes block a thread and make - // other read threads wait for it to finish. The timestamp is a workaround to ensure - // only one thread can be running the full text search at one time. - let currentQueryTimestamp = NSDate.millisecondTimestamp() - newQueryTimestamp = currentQueryTimestamp let query = FullTextSearchFinder.query(searchText: searchText) @@ -108,7 +99,7 @@ public class FullTextSearchFinder: NSObject { snippetOptions.endMatchText = "" snippetOptions.numberOfTokens = 5 ext.enumerateKeysAndObjects(matching: query, with: snippetOptions) { (snippet: String, _: String, _: String, object: Any, stop: UnsafeMutablePointer) in - guard searchResultCount < maxSearchResults && currentQueryTimestamp >= self.newQueryTimestamp else { + guard searchResultCount < maxSearchResults else { stop.pointee = true return }