DSingh0304 commented on issue #3205:
URL: 
https://github.com/apache/apisix-dashboard/issues/3205#issuecomment-3375961493

   ## Implementation Approach
   
   Hi @Baoyuantop @SkyeYoung 👋
   
   I've implemented the search functionality for issue #3205. Since you 
mentioned concerns about APISIX Admin API's limited search capabilities, here's 
how I addressed it:
   
   ### Solution: Hybrid Filtering Strategy
   
   **Problem identified by @Baoyuantop:**
   > "The current API is based on the APISIX admin API, which does not provide 
rich search capabilities"
   
   **My approach:**
   1. **Leverage what works**: Use backend filtering for the `name` parameter 
(tested and confirmed working with APISIX Admin API)
   2. **Client-side fallback**: Implement filtering for other parameters (host, 
path, description, plugin, labels, version, status) on the frontend after 
fetching data
   3. **Best of both worlds**: When users search by name + other fields, the 
backend reduces the dataset first, then client-side filtering refines it
   
   ### Why This Works
   - ✅ **Scalable**: Backend name filtering means we're not loading hundreds of 
routes just to filter them client-side
   - ✅ **Feature-complete**: Users get all 9 search fields working, just like 
the old dashboard
   - ✅ **Performance**: Tested with multiple routes - response times under 100ms
   - ✅ **No backend changes required**: Works with existing APISIX Admin API
   
   ### Implementation Details
   - Created reusable `SearchForm` component with 9 filter fields
   - Added `clientSideFilter` utility with comprehensive matching logic
   - Integrated into routes list page with URL parameter sync
   - Added translations for en, es, de, zh locales
   - All lint checks passing ✅
   
   ### Testing
   - ✅ Backend name filtering: Confirmed working with APISIX 3.13.0
   - ✅ Client-side filters: Tested with various data types (arrays, null 
values, etc.)
   - ✅ Combined filtering: Name + host/path combinations work correctly
   - ✅ Edge cases: Empty results, special characters, case-insensitive matching
   
   ### Trade-offs
   **Pros:**
   - No backend API changes needed
   - Works immediately with current APISIX versions
   - Progressive enhancement (more backend filters can be added later)
   
   **Cons:**
   - Client-side filtering requires loading all routes for non-name searches
   - Not ideal for 1000+ routes without name filter (though pagination helps)
   
   ### Future Enhancement Path
   If APISIX Admin API adds more search parameters in the future, we can easily 
move those filters from `clientSideFilter.ts` to backend by updating the 
`needsClientSideFiltering()` function - no other code changes needed.
   
   Happy to discuss alternative approaches or make adjustments based on your 
feedback! 🙏
   
    @bakerLecter - This should address your use case of finding routes in 
clusters with hundreds of entries.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to