Fixed logDebug() call
This commit is contained in:
@@ -172,7 +172,9 @@ export class Omnisearch {
|
||||
break
|
||||
}
|
||||
|
||||
let results = this.minisearch.search(tokenizeForSearch(query.segmentsToStr()), {
|
||||
const searchTokens = tokenizeForSearch(query.segmentsToStr())
|
||||
logDebug(JSON.stringify(searchTokens, null, 1))
|
||||
let results = this.minisearch.search(searchTokens, {
|
||||
prefix: term => term.length >= options.prefixLength,
|
||||
// length <= 3: no fuzziness
|
||||
// length <= 5: fuzziness of 10%
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user