Skip to content

Commit

Permalink
Fix tagging, spacing and wrapping in combine{And,Or} (#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonggrijp committed May 31, 2021
1 parent b2ebd9e commit 6ffbf62
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frontend/src/semantic-search/modelToQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export function combineAnd({ expression, pattern }: Branches): TaggedSyntax {
const exp = expression ? `(${joinE(expression, ' && ')})` : '';
const pat = pattern ? joinP(pattern, '') : '';
if (exp) {
if (pat) return tagExpression(`${pat}FILTER ${exp}\n`);
if (pat) return tagPattern(`${pat}FILTER ${exp}\n`);
return tagExpression(exp);
}
return tagPattern(pat);
Expand All @@ -116,9 +116,9 @@ export function combineAnd({ expression, pattern }: Branches): TaggedSyntax {
export function combineOr({ expression, pattern }: Branches): TaggedSyntax {
if (expression) {
const patExp = pattern ? map(pattern, patternAsExpression) : [];
return tagExpression(`${joinE(expression.concat(patExp), ' || ')}`);
return tagExpression(`(${joinE(expression.concat(patExp), ' || ')})`);
}
return tagPattern(`{\n${joinP(pattern, '} UNION {\n')}}`);
return tagPattern(`{\n${joinP(pattern, '} UNION {\n')}}\n`);
}

const combine = {
Expand Down

0 comments on commit 6ffbf62

Please sign in to comment.