Skip to content

Add source filter support in bot search feature#1858

Open
ShivCharanSharma wants to merge 2 commits intoKhalisFoundation:devfrom
ShivCharanSharma:feat/bot-search-source-filter
Open

Add source filter support in bot search feature#1858
ShivCharanSharma wants to merge 2 commits intoKhalisFoundation:devfrom
ShivCharanSharma:feat/bot-search-source-filter

Conversation

@ShivCharanSharma
Copy link

@ShivCharanSharma ShivCharanSharma commented Feb 25, 2026

Feat: Add source filter support in AskGurbaniBot search | Fixes #1828

Summary

This PR fixes issue #1828 by adding source selection support to the Ask GurbaniBot modal and ensuring its search state is fully isolated from the main site search (header/SearchForm) state.


Changes

✨ feat: Add source selection to AskGurbaniBot search

  • Added a source selector (<select>) inside AskGurbaniBotQuestionModal so users can filter which Gurbani source the bot searches from.
  • Updated AskGurbaniBotSearch to accept and pass the selected source value through to the bot API query.
  • Pass the selected source from the modal to the SearchResults component for the bot search.

🔒 feat: Isolate bot search state from main/normal search state

  • Introduced an isolateFromLocalStorage boolean prop on SearchForm to prevent the bot's form state (type, source, writer) from being read from or written to localStorage.
  • The AskGurbaniBotQuestionModal now passes isolateFromLocalStorage to its SearchForm, keeping the bot's selections completely independent of the main header search.
  • Added centralized saveToLocalStorage and removeFromLocalStorage helper methods inside SearchForm that respect the isolateFromLocalStorage flag — all existing localStorage calls now route through these helpers.
  • The main/header search state and local storage preferences are no longer affected when a user interacts with the GurbaniBot search.

Files Changed

File Change
src/js/components/Modals/AskGurbaniBotQuestionModal.tsx Added source selector UI; added isolateFromLocalStorage prop
src/js/components/SearchResults/AskGurbaniBotSearch.tsx Wired source prop through to the bot API
src/js/components/SearchForm.js Added isolateFromLocalStorage prop & localStorage helper methods
src/js/components/Header.js Minor formatting/indentation cleanup

  • Passed sanity tests.
    • Checked the sanity tests that, for which I was able to find input or elements
  • Ran npm test & fixed newly introduced lint errors.
  • Checked console for errors.
    • I found 3 existing console warning in dev branch, and these are unrelated to changes in this PR, please let me if I should fix those too, by creating a new PR
      • Failed prop type: Invalid propdefaultAutoDetectGurmukhiof typebooleansupplied toSearchForm, expected string.
      • Warning: validateDOMNesting(...): <button> cannot appear as a descendant of <button>. Error Component Stack for FloatingActions
      • installHook.js:1 Warning: Each child in a list should have a unique "key" prop. in HomePageIcons

Testing

  • Open the Ask GurbaniBot modal, change the source, and confirm the header search source is not affected.
  • Use the GurbaniBot with a specific source and verify results are filtered accordingly.

Demo Video

https://drive.google.com/file/d/1C_t8AA7QLJFOmsoQiZ5cgFZUWsaOCWsP/view?usp=sharing

npm test output

image

Updated UI screenshots

image image

- Isolate SearchForm state from local storage by introducing an `isolateFromLocalStorage` prop and using it for the Gurbani Bot search.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant