Skip to content

Commit cc1e31f

Browse files
authored
Fix: Plugin QPS Type & where clause not working propertly (#957)
2 parents bf08af6 + 7847516 commit cc1e31f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packages/plugin-qps/src/index.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function search<T extends AnyOrama>(index: QPSIndexStorage, term: string, tokeni
5656
return res
5757
}
5858

59-
export function pluginQPS(): OramaPluginSync {
59+
export function pluginQPS(): OramaPluginSync<unknown> {
6060
return {
6161
name: 'qps',
6262
getComponents(schema: AnySchema) {
@@ -181,7 +181,16 @@ function qpsComponents(schema: AnySchema): Partial<ObjectComponents<any, any, an
181181

182182
let idsFromStringFilters: Set<InternalDocumentID> | undefined
183183
for (const [propName, filter] of stringFiltersList) {
184-
const tokens = tokenizer.tokenize(filter as string, language)
184+
let tokens: string[] = [];
185+
186+
if (Array.isArray(filter)) {
187+
for (const item of filter) {
188+
const token = tokenizer.tokenize(item as string, language)?.[0]
189+
tokens.push(token)
190+
}
191+
} else {
192+
tokens = tokenizer.tokenize(filter as string, language)
193+
}
185194

186195
const radixTree = index.indexes[propName].node as radix.RadixNode
187196
const propIds = new Set<InternalDocumentID>()

0 commit comments

Comments
 (0)