feat(keywords): add search intent filter to Keyword Research#76
Merged
Merged
Conversation
Add a multi-select intent filter (Informational, Commercial, Transactional, Navigational, Unknown) to the Keyword Research table on both the desktop and mobile layouts (closes every-app#67). Selected intents are stored as a comma-separated string in a new `intents` filter field, so they fit the existing all-strings filter shape and get active-filter counting, persistence, and clear-all for free. Sorting, pagination, save, and export already derive from the filtered row set, so they respect the intent filter automatically. The persistence schema defaults `intents` to "" so filter blobs saved before this change still load. Intent classification and URL params are untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Contributor
|
Hey maria, thanks for this! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #67.
What
Adds a multi-select intent filter (Informational, Commercial, Transactional, Navigational, Unknown) to the Keyword Research table, so users can isolate e.g. transactional terms instead of scanning the intent badges by hand.
Coverage (per the acceptance criteria)
EmptyFilterResults, shared by both layouts).Design
intentsfield onKeywordFilterValues. This deliberately fits the existing all-strings filter shape: active-filter counting (Object.values(...).filter(v => v.trim() !== "")), thez.string()persistence schema, and clear-all all work with no special-casing. Reads/writes go throughparseIntentFilter/toggleIntentFilter, which keep a canonical order and de-duplicate.filteredRows, they respect the intent filter automatically — no changes needed there.intentsto"", so filter blobs saved before this change still load instead of being discarded.Tests
useKeywordFiltering.test.ts: single-intent, multiple-intent, intent + other filters (AND), invalid-token handling, and theparseIntentFilter/toggleIntentFilterhelpers.useLocalKeywordFilters.test.ts: persistence migration (a legacy blob with nointentskey loads withintents: ""and keeps the user's other filters).pnpm ci:checkand the fullpnpm testsuite pass.Notes
IntentBadge(INTENT_LABELS) so the table and the filter stay in sync.keywordResearchDesktopFilters.tsx→keywordResearchFilters.tsx, since the shared filter components (including the new one) are now imported by the mobile layout too.Greptile Summary
This PR adds a multi-select search intent filter to Keyword Research. The main changes are:
IntentBadgeand the new filter UI.intentsfilter state with canonical parsing and toggling helpers.Confidence Score: 5/5
Safe to merge with low risk.
The changes are focused on client-side filter state and UI, reuse the existing string-based filter model, and include tests for filtering and persistence migration.
No files require special attention.
What T-Rex did
Important Files Changed
intentsto keyword filter state plus canonical parsing and toggling helpers for intent multi-select serialization.intentsstring field.Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant User participant FilterUI as Desktop/Mobile FilterIntentSelect participant Form as filtersForm.values.intents participant Parser as parseIntentFilter/toggleIntentFilter participant Filtering as useKeywordFiltering participant Results as Table/Pagination/Save/Export User->>FilterUI: Click intent button FilterUI->>Parser: toggleIntentFilter(current, intent) Parser-->>Form: Canonical comma-separated intents Form->>Filtering: Updated KeywordFilterValues Filtering->>Parser: parseIntentFilter(intents) Filtering-->>Results: filteredRows matching selected intents Results-->>User: Updated rows, counts, pagination, save/export set%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant User participant FilterUI as Desktop/Mobile FilterIntentSelect participant Form as filtersForm.values.intents participant Parser as parseIntentFilter/toggleIntentFilter participant Filtering as useKeywordFiltering participant Results as Table/Pagination/Save/Export User->>FilterUI: Click intent button FilterUI->>Parser: toggleIntentFilter(current, intent) Parser-->>Form: Canonical comma-separated intents Form->>Filtering: Updated KeywordFilterValues Filtering->>Parser: parseIntentFilter(intents) Filtering-->>Results: filteredRows matching selected intents Results-->>User: Updated rows, counts, pagination, save/export setReviews (1): Last reviewed commit: "feat(keywords): add search intent filter..." | Re-trigger Greptile