Fixed logDebug() call

This commit is contained in:
Simon Cambier
2024-01-22 22:12:41 +01:00
parent cf1c328e77
commit 4b8bf437ce
2 changed files with 6 additions and 6 deletions

View File

@@ -58,24 +58,22 @@ export function tokenizeForIndexing(text: string): string[] {
export function tokenizeForSearch(text: string): QueryCombination {
const tokens = tokenizeTokens(text)
const chsSegmenter = getChsSegmenter()
let chs: string[] = []
const chsSegmenter = getChsSegmenter()
if (chsSegmenter) {
chs = tokens.flatMap(word =>
chsRegex.test(word) ? chsSegmenter.cut(word) : [word]
)
}
const query = {
return {
combineWith: 'OR',
queries: [
{ combineWith: 'AND', queries: tokens },
{ combineWith: 'AND', queries: tokenizeWords(text) },
{ combineWith: 'AND', queries: tokens.flatMap(splitHyphens) },
{ combineWith: 'AND', queries: tokens.flatMap(splitCamelCase) },
{ combineWith: 'AND', queries: chs },
{ combineWith: 'AND', queries: tokenizeWords(text) },
],
}
logDebug(JSON.stringify(query, null, 1))
return query
}