Skip to content

Fix type filter silently dropped on Vocabulary page#180

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-vocabulary-type-filtering
Draft

Fix type filter silently dropped on Vocabulary page#180
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-vocabulary-type-filtering

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 29, 2026

The type:sentence/word/phrase filter (both from the dropdown and typed directly) had no effect because the parser discarded it before it ever reached ApplyFilters.

Root Cause

"type" was missing from three places in the search parser stack:

  • FilterToken.ValidTypes — caused every type:* token to fail IsValid and be silently dropped
  • SearchQueryParser.FilterPattern regex — type:sentence was never matched, falling through as free text
  • SearchQueryParser.DetectActiveFilter regex — typing type: in the search bar triggered no autocomplete

ApplyFilters in Vocabulary.razor already had correct LexicalUnitType switch logic; it simply never received the filter.

Changes

  • FilterToken.cs — add "type" to ValidTypes
  • SearchQueryParser.cs — add type to both FilterPattern and DetectActiveFilter regex alternation groups
  • SearchQueryParserTests.cs — add theory tests for type:word, type:phrase, type:sentence, mixed queries, and IsValidFilterToken type values

- Add 'type' to FilterToken.ValidTypes so type:sentence/word/phrase passes IsValid check
- Add 'type' to SearchQueryParser.FilterPattern regex so it's recognized and parsed
- Add 'type' to SearchQueryParser.DetectActiveFilter regex for autocomplete support
- Add unit tests covering type:word, type:phrase, type:sentence, mixed queries"

Agent-Logs-Url: https://github.com/davidortinau/SentenceStudio/sessions/7ef0d148-4758-461b-be3d-0b2760b18ee6

Co-authored-by: davidortinau <41873+davidortinau@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix type filtering on Vocabulary page for 'Sentence' Fix type filter silently dropped on Vocabulary page Apr 29, 2026
Copilot AI requested a review from davidortinau April 29, 2026 02:21
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.

[Bug] Type filtering not working on Vocabulary page

2 participants