feat: 💨

This commit is contained in:
codytseng
2025-02-03 22:45:15 +08:00
parent 97ccb3cb7c
commit b292b3e3b5
3 changed files with 27 additions and 8 deletions

View File

@@ -79,7 +79,7 @@ class ClientService extends EventTarget {
})
private userIndex = new FlexSearch.Index({
tokenize: 'full'
tokenize: 'forward'
})
constructor() {
@@ -504,8 +504,8 @@ class ClientService extends EventTarget {
return readRelays
}
async searchProfilesFromIndex(query: string) {
const result = await this.userIndex.searchAsync(query, { limit: 100 })
async searchProfilesFromIndex(query: string, limit: number = 100) {
const result = await this.userIndex.searchAsync(query, { limit })
return Promise.all(result.map((pubkey) => this.fetchProfile(pubkey as string))).then(
(profiles) => profiles.filter(Boolean) as TProfile[]
)