Skip to content

feat(search): implement Node Affinity for filter controls and hooks#621

Open
martinshub-tech wants to merge 1 commit into
rinafcode:mainfrom
martinshub-tech:feature/filter-affinity
Open

feat(search): implement Node Affinity for filter controls and hooks#621
martinshub-tech wants to merge 1 commit into
rinafcode:mainfrom
martinshub-tech:feature/filter-affinity

Conversation

@martinshub-tech
Copy link
Copy Markdown
Contributor

this pr closes #476

Overview

Implemented the Node Affinity configuration for search filter controls. This feature allows users to route search/filter execution to specific cluster nodes (Auto, Primary, Replica, or Edge Cache) dynamically.

  • State Syncing: Added nodeAffinity to the FilterState structure inside both useSearchFilters hooks (Pages Router & App Router versions).
  • URL Parameter Binding: Integrated nodeAffinity state to sync with the affinity query parameter in URL, supporting state preservation across navigations.
  • UI Integration: Designed a premium Node Affinity options card inside both FilterSidebar component implementations with clear descriptions for each routing mode.
  • Visual Design: Added the Cpu icon from Lucide-React and clean radio inputs following the application’s design system (borders, peer-checked backgrounds, and hover micro-animations).

Files Changed / Added

Action File Description
Modify src/app/hooks/useSearchFilters.ts Added nodeAffinity support to App router search filter hook.
Modify src/hooks/useSearchFilters.tsx Added nodeAffinity support to Pages router search filter hook.
Modify src/app/components/search/FilterSidebar.tsx Added Node Affinity control panel to App router sidebar.
Modify src/components/search/FilterSidebar.tsx Added Node Affinity control panel to Pages router sidebar.
New src/app/components/search/__tests__/FilterSidebar.test.tsx Unit tests for App router sidebar Node Affinity.
New src/components/search/__tests__/FilterSidebar.test.tsx Unit tests for Pages router sidebar Node Affinity.

Rationale

Previously, search queries were dispatched without any node routing constraints. This resulted in redundant or sub-optimal execution targets in replica-heavy or edge-distributed environments. By adding Node Affinity to the Filter Controls, we empower users/developers to specify execution targets (such as requesting strong consistency from the Primary Cluster or low-latency from the Edge Cache), improving search quality, caching efficiency, and database load distribution.

Testing

  • Unit tests verify that the FilterSidebar renders all four Node Affinity options (Auto, Primary, Replica, Edge).
  • Tests confirm that changing options triggers the correct onFilterChange callback with the updated nodeAffinity payload.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@martinshub-tech Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

feature Filter Controls : Node Affinity

1 participant