Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing Search Algorithm #25

Merged
merged 3 commits into from
Sep 25, 2024
Merged

Implementing Search Algorithm #25

merged 3 commits into from
Sep 25, 2024

Conversation

heyanuja
Copy link

### Main Search Function (searchApi.categories):

Search Query Check: It checks if a search query (data.search) is provided.
If yes, it calls findMatchedCids to find the categories that match the query.
If no, it calls loadCids to load all categories.
Privileges and Watch States: It checks what the user is allowed to see based on their permissions and watch states.
Marking Categories: Categories that are matched by the search or selected by the user are marked for easy identification in the UI.
Final Result: The function returns the filtered list of categories that match the search query or all categories if no search is performed.
Search Helper (findMatchedCids):

Category Search: It uses the built-in categories.search() method to search for categories based on the query.
Watch State Filtering: It optionally filters the results based on the user's watch state (e.g., watching, tracking).
Parent and Child Category Handling: It expands the search results to include parent and child categories, not just the exact matches.
Category Loader (loadCids):

Loads All Categories: This function loads categories recursively if there is no search query provided. It ensures all child categories are included, depending on the parent category.

Plan for Testing:
Front-End Integration:
Going to ensure that the search bar on the UI correctly sends the search query to the backend. Maybe from frontend , should be able to trigger this API with the search input.

Test Basic Search:
Should enter different search queries in the search bar.
Ensure that the categories displayed are filtered based on the input.

Test Edge Cases:
No Search Query: If no search query is provided, the system should return all categories.
Case-Insensitive Search: Ensure that the search works regardless of case (e.g., searching "General" and "general" should give the same result).

Special Characters: Test how the search handles categories with special characters.

@heyanuja heyanuja merged commit ba5e266 into f24 Sep 25, 2024
1 check failed
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.

1 participant