Skip to content

In operator logic#10

Merged
gblikas merged 3 commits intomainfrom
cursor/in-operator-logic-e60a
Feb 1, 2026
Merged

In operator logic#10
gblikas merged 3 commits intomainfrom
cursor/in-operator-logic-e60a

Conversation

@gblikas
Copy link
Copy Markdown
Owner

@gblikas gblikas commented Feb 1, 2026

Adds support for IN operator syntax and Liqe RangeExpression to the query parser to enhance query capabilities and fix parsing errors.

The existing parser did not correctly handle field in (val1, val2) or field:[val1, val2] syntax, which are common patterns for checking if a field's value is within a set of values. Additionally, while Liqe itself supports RangeExpression (e.g., field:[min TO max]), the parser was not converting these into the appropriate AND comparison expressions. This PR introduces a pre-processing step to convert IN and array-like bracket syntax into Liqe-compatible OR expressions and adds specific handling for Liqe's RangeExpression type.


Open in Cursor Open in Web


Note

Medium Risk
Moderate risk because it changes core parsing/validation behavior via regex-based preprocessing and new AST conversion paths, which could affect edge-case query strings.

Overview
Adds support for set-membership and range syntax in the query parser. QueryParser.parse/validate now pre-process queries to accept field in (a, b, ...) and field:[a, b, ...] by rewriting them into Liqe-compatible (field:a OR field:b ...) strings (with basic quoting/escaping).

Also adds explicit handling for Liqe RangeExpression so field:[min TO max] and field:{min TO max} are converted into AND-combined comparisons with inclusive/exclusive bounds. Tests are expanded to cover the new IN syntaxes, mixed expressions, case-insensitive IN, quoted values, and range preservation.

Written by Cursor Bugbot for commit cab3326. Configure here.

- Add pre-processing to convert 'field in (val1, val2, ...)' syntax to OR expressions
- Add pre-processing to convert 'field:[val1, val2, ...]' bracket array syntax to OR expressions
- Add support for Liqe RangeExpression type (e.g., 'field:[min TO max]')
- Range expressions are converted to logical AND with >= and <= comparisons
- Exclusive ranges (field:{min TO max}) use > and < operators
- Add comprehensive tests for all new IN operator functionality

Fixes the bug where 'status in (todo, doing, done)' was being treated as a
full-text search instead of an IN operator expression.
@cursor
Copy link
Copy Markdown

cursor Bot commented Feb 1, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Feb 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
querykit Ready Ready Preview, Comment Feb 1, 2026 10:07pm

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on March 18

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Comment thread src/parser/parser.ts Outdated
Comment thread src/parser/parser.ts Outdated
…pattern

Remove the 'field in (val1, val2, ...)' syntax in favor of the cleaner
'field:[val1, val2, ...]' bracket syntax. This keeps the query language
consistent with the existing 'key:value' pattern used throughout QueryKit:

- priority:>2     (comparison)
- status:active   (equality)
- status:[todo, doing, done]  (IN / multiple values)
- id:[1 TO 10]    (range)

The bracket syntax is more intuitive for users since all operators follow
the same 'key:' prefix pattern.
The convertToOrExpression method was using a simple split(',') to parse
values, which didn't respect quoted strings. A query like:

  name:["John, Jr.", "Jane"]

Would incorrectly split at the internal comma, producing malformed output.

This fix adds a proper parseCommaSeparatedValues() method that:
- Tracks quote state (single and double quotes)
- Only splits on commas outside of quotes
- Handles escaped characters within quoted strings
- Preserves the original quoting for downstream processing

Added 3 new tests to validate:
- Double-quoted values with commas
- Single-quoted values with commas
- Mixed quoted and unquoted values with commas
@gblikas gblikas marked this pull request as ready for review February 1, 2026 22:09
@gblikas gblikas merged commit 1942165 into main Feb 1, 2026
6 checks passed
@gblikas gblikas deleted the cursor/in-operator-logic-e60a branch February 1, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants