Skip to content

Remove excluding files on search. #5246

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

Merged
merged 3 commits into from
Feb 7, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions readthedocs/search/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,22 @@ def get_queryset(self):
"""Overwrite default queryset to filter certain files to index"""
queryset = super(PageDocument, self).get_queryset()

# Exclude some files to not index
excluded_files = [
'search.html',
'genindex.html',
'py-modindex.html',
'search/index.html',
'genindex/index.html',
'py-modindex/index.html',
]

# Do not index files that belong to non sphinx project
# Also do not index certain files
queryset = queryset.filter(project__documentation_type__contains='sphinx')
for ending in excluded_files:
queryset = queryset.exclude(path__endswith=ending)

# TODO: Make this smarter
# This was causing issues excluding some valid user documentation pages
# excluded_files = [
# 'search.html',
# 'genindex.html',
# 'py-modindex.html',
# 'search/index.html',
# 'genindex/index.html',
# 'py-modindex/index.html',
# ]
# for ending in excluded_files:
# queryset = queryset.exclude(path=ending)

return queryset