Skip to content

Commit

Permalink
Merge pull request #485 from atelier-saulx/fix/no-indexing-has
Browse files Browse the repository at this point in the history
disable indexing for `has` filter operator
  • Loading branch information
OlliV authored Mar 8, 2024
2 parents 9f59284 + ea0a173 commit bd36361
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions client/src/get/executeGetOperations/indexing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,6 @@ function ast2inlineRpn(schema: Schema, f: FilterAST | null): string | null {
const num = Number(f.$value)
return Number.isNaN(num) ? null : `"${f.$field}" g #${num} F`
}
case 'has':
if (['ancestors', 'children', 'descendants', 'parents'].includes(f.$field)) {
return null
}

if (typeof f.$value === 'string') {
return `"${f.$value}" "${f.$field}" a`
} else if (typeof f.$value === 'number') {
return `#${f.$value} "${f.$field}" a`
} else if (Array.isArray(f.$value)) {
if (typeof f.$value[0] === 'string') {
if (f.$value.some((v: string) => v.includes('"'))) {
// We can't inline quotes at the moment
return null
}

const a = `{${f.$value.map((v) => `"${v}"`).join(',')}}`
return `"${f.$field}" ${a} l`
} else if (typeof f.$value[0] === 'number') {
const a = `{${f.$value.map((v) => `#${v}`).join(',')}}`
return `"${f.$field}" ${a} l`
}
return null
}
case 'exists':
return `"${f.$field}" h`
case 'notExists':
Expand Down

0 comments on commit bd36361

Please sign in to comment.