@enonic/js-utils
Version:
Enonic XP JavaScript Utils
29 lines (24 loc) • 466 B
text/typescript
import type {PathMatchDslExpression} from '/lib/xp/node';
interface QueryExpressionPathMatch {
pathMatch: PathMatchDslExpression
}
export function pathMatch(
field: string,
path: string,
minimumMatch?: number,
boost?: number,
): QueryExpressionPathMatch {
const pathMatch: PathMatchDslExpression = {
field,
path
}
if (minimumMatch) {
pathMatch.minimumMatch = minimumMatch;
}
if (boost) {
pathMatch.boost = boost;
}
return {
pathMatch
};
}