Skip to content

Conversation

@stsewd
Copy link
Member

@stsewd stsewd commented Nov 19, 2025

This allows us to mark a project so it's never indexed for search. Currently, we will mark these projects manually and create the notification so users are aware of this change and can re-enable search indexing in case we made a mistake without contacting support.

ref https://github.com/readthedocs/meta/issues/197#issuecomment-3518456511

@stsewd
Copy link
Member Author

stsewd commented Nov 19, 2025

@copilot write tests for this

Copy link
Contributor

Copilot AI commented Nov 19, 2025

@stsewd I've opened a new pull request, #12585, to work on those changes. Once the pull request is ready, I'll request review from you.

@stsewd stsewd requested a review from Copilot November 19, 2025 21:36
Copilot finished reviewing on behalf of stsewd November 19, 2025 21:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds the ability to disable search indexing for specific projects by introducing a new search_indexing_enabled boolean field. Projects marked with this field set to False will not have their content indexed for search, helping optimize resources for projects with low search usage. Users can re-enable search indexing through the project settings form, which triggers a notification cancellation and reindexing.

  • Adds search_indexing_enabled field to the Project model (defaults to True)
  • Filters out projects with disabled search indexing from all search document queries and indexing tasks
  • Provides UI for users to re-enable search when it has been disabled, including automatic notification cleanup

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
readthedocs/projects/models.py Adds new search_indexing_enabled boolean field to Project model
readthedocs/projects/migrations/0156_project_search_indexing_enabled.py Migration to add the new field to both Project and HistoricalProject models
readthedocs/search/documents.py Filters ProjectDocument and PageDocument queries to exclude projects with search disabled
readthedocs/projects/tasks/search.py Prevents SearchIndexer creation for projects with search disabled
readthedocs/builds/querysets.py Filters version reindex queries to exclude projects with search disabled
readthedocs/projects/forms.py Adds form field for re-enabling search, triggers reindexing on enable, cancels notification
readthedocs/projects/notifications.py Adds notification message to inform users about disabled search indexing
readthedocs/projects/tests/test_views.py Tests form behavior for search_indexing_enabled field visibility and functionality
readthedocs/projects/tests/test_indexers.py Tests that SearchIndexer respects the search_indexing_enabled flag

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@stsewd stsewd marked this pull request as ready for review November 19, 2025 21:45
@stsewd stsewd requested a review from a team as a code owner November 19, 2025 21:45
@stsewd stsewd requested a review from humitos November 19, 2025 21:45
@stsewd stsewd requested a review from ericholscher November 19, 2025 21:58
@stsewd stsewd moved this to Needs review in 📍Roadmap Nov 20, 2025
"versioning_scheme",
"default_branch",
"readthedocs_yaml_path",
"search_indexing_enabled",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably like to see us migrate to a full Search settings page, instead of throwing more on this form. I don't think it'll be a ton of work, and highlights search as a first-class feature.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment this is only shown to users that have search indexing disabled, so they can rollback this change in case we make a mistake.

type=INFO,
),
# NOTE: Disabling search for projects and notifying users is done manually for now.
Message(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message isn't created in this PR -- are we planning to enable it elsewhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm planning on disabling search indexing on projects with no searches and that haven't been updated in the last 3 years (103003 projects), remove them from the index and also create the notification. For .com projects without an active subscription and that haven't been updated in some months.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be done via a script for now. We can consider automating this next.

@stsewd stsewd merged commit a9aa9cb into main Nov 21, 2025
11 checks passed
@stsewd stsewd deleted the allow-deleting-search-index branch November 21, 2025 00:09
@github-project-automation github-project-automation bot moved this from Needs review to Done in 📍Roadmap Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants