Skip to content

Remove query parser characters from search term - #2148

Merged
travisbeckham merged 2 commits into
mainfrom
travis/search
Aug 5, 2026
Merged

Remove query parser characters from search term#2148
travisbeckham merged 2 commits into
mainfrom
travis/search

Conversation

@travisbeckham

@travisbeckham travisbeckham commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Lunr's query parser treats characters like : + - * ~ ^ as query syntax, so this PR removes them to keep user input literal and avoid throwing an error if a search term contains one of them.

Lunr docs
https://lunrjs.com/guides/searching.html#fields

The search term is prefixed with the name of the field, followed by a colon (:). The field must be one of the fields defined when building the index. Unrecognised fields will lead to an error.

@travisbeckham
travisbeckham requested a review from alpeb July 24, 2026 14:13

@alpeb alpeb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wasn't aware of that syntax. It could give us finer query control, but I guess there's a trade-off with ease-of-use and predictability that argues against enabling these advanced features in this context.

@travisbeckham
travisbeckham merged commit ba622f8 into main Aug 5, 2026
7 checks passed
@travisbeckham
travisbeckham deleted the travis/search branch August 5, 2026 15:26
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