mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
16 lines
488 B
TypeScript
16 lines
488 B
TypeScript
|
import { defaultMatcher } from './query/matcher';
|
||
|
import { generateLexArray } from './query/lex';
|
||
|
import { parseTokens } from './query/parse';
|
||
|
import { getAstMatcherForTerm } from './query/term';
|
||
|
|
||
|
function parseWithDefaultMatcher(term: string, fuzz: number) {
|
||
|
return getAstMatcherForTerm(term, fuzz, defaultMatcher);
|
||
|
}
|
||
|
|
||
|
function parseSearch(query: string) {
|
||
|
const tokens = generateLexArray(query, parseWithDefaultMatcher);
|
||
|
return parseTokens(tokens);
|
||
|
}
|
||
|
|
||
|
export default parseSearch;
|