Skip to content

Fix: Restrict search indexing to active apps only#117

Open
qzMalekuz wants to merge 2 commits intocytoscape:masterfrom
qzMalekuz:fix-search-index-active-only
Open

Fix: Restrict search indexing to active apps only#117
qzMalekuz wants to merge 2 commits intocytoscape:masterfrom
qzMalekuz:fix-search-index-active-only

Conversation

@qzMalekuz
Copy link
Copy Markdown

@qzMalekuz qzMalekuz commented Feb 26, 2026

This PR ensures that only active apps are indexed by Haystack by implementing index_queryset() in AppIndex.

Previously, inactive apps could appear in search results.
This change filters the index to App.objects.filter(active=True).

Related Issue - #114

Search was indexing inactive apps while the detail view requires active=True.
This caused search results to link to 404 pages.

Override index_queryset() in AppIndex to ensure only active apps are indexed.
@qzMalekuz
Copy link
Copy Markdown
Author

I have tested this locally and everything works as expected. Please let me know if any changes are needed.

@coleslaw481
Copy link
Copy Markdown
Contributor

Could you add a unit test for this to apps/tests.py and double check the tests pass. thanks

@qzMalekuz
Copy link
Copy Markdown
Author

Added a regression test to ensure AppIndex.index_queryset() only indexes active apps.
Updated implementation to filter active=True.

All tests pass locally using make test.

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.

2 participants