Skip to content

Querykit issue 19#20

Merged
gblikas merged 5 commits intomainfrom
cursor/querykit-issue-19-51b1
Mar 12, 2026
Merged

Querykit issue 19#20
gblikas merged 5 commits intomainfrom
cursor/querykit-issue-19-51b1

Conversation

@gblikas
Copy link
Owner

@gblikas gblikas commented Mar 12, 2026

Implement case-insensitive boolean operators, expose parser options, and add a tolerant parsing mode to address issue #19.

The primary bug fixed involved lowercase boolean operators (and, or, not) causing crashes because Liqe only recognizes uppercase versions, treating lowercase as bare search terms. This PR normalizes these operators before parsing. Additionally, a new tolerant mode leverages Liqe's parseWithContext to automatically fix common query syntax errors like unclosed quotes or trailing operators, significantly improving user experience.

Open in Web Open in Cursor 

Liqe only recognizes uppercase AND, OR, NOT as boolean operators.
Lowercase variants (and, or, not) were treated as bare search terms,
producing ImplicitField AST nodes that lack an operator property,
causing 'Cannot read properties of undefined' crashes during
QueryKit's AST conversion.

The fix adds a normalizeBooleanOperators step to preprocessQuery that
uppercases and/or/not outside of quoted strings before passing to Liqe.

Fixes #19
Add parserOptions to IQueryKitOptions, passed through to the
QueryParser constructor. This enables field mappings and case-insensitive
field names at the createQueryKit level without requiring consumers to
build fragile string-level preprocessing.

Add tolerant mode (tolerant: boolean) that uses parseWithContext with
autofix recovery instead of parse, allowing the execution pipeline to
gracefully handle incomplete queries (trailing operators, unclosed
quotes, unbalanced parentheses) — useful for search UIs where queries
may be submitted in transiently incomplete states.

Fixes #19
…erators

Update README to cover:
- parserOptions (fieldMappings, caseInsensitiveFields) configuration
- Tolerant parse mode for search UIs with autofix recovery
- Case-insensitive boolean operators (and/or/not) in query syntax

Ref #19
@cursor
Copy link

cursor bot commented Mar 12, 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
Contributor

vercel bot commented Mar 12, 2026

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

Project Deployment Actions Updated (UTC)
querykit Ready Ready Preview, Comment Mar 12, 2026 8:28pm

Copy link
Owner Author

@gblikas gblikas left a comment

Choose a reason for hiding this comment

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

Pending QA.

@gblikas gblikas marked this pull request as ready for review March 12, 2026 19:17
The regex \b(and|or|not)\b matched at colon boundaries, causing
unquoted field values like name:and to become name:AND — which Liqe
rejects because uppercase AND/OR/NOT are reserved boolean keywords.

Replace word-boundary anchors with context-aware lookarounds that
only match when the keyword is in boolean operator position:
surrounded by whitespace, parentheses, or string boundaries. This
correctly preserves and/or/not as field values, comparison operands,
and field names while still normalizing them as operators.

Fixes #19
@gblikas gblikas merged commit 29cc598 into main Mar 12, 2026
6 checks passed
@gblikas gblikas deleted the cursor/querykit-issue-19-51b1 branch March 12, 2026 21:05
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