Skip to content

Commit b2cdd97

Browse files
authored
Addons: normalize search filters (#10951)
Currently, we have two filters on shown by default in the search modal. However, they are not super useful to work together. I changed this behavior (for now) to be: * Default: search on the current project * Include subprojects: also include results from subprojects Note this will be configurable by the user once we expose the addons admin page in readthedocs/ext-theme#211 Closes readthedocs/addons#209
1 parent b2add87 commit b2cdd97

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

readthedocs/proxito/tests/responses/v0.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,9 @@
117117
"search": {
118118
"enabled": true,
119119
"api_endpoint": "/_/api/v3/search/",
120-
"default_filter": "subprojects:project/latest",
120+
"default_filter": "project:project/latest",
121121
"filters": [
122-
["Search only in this project", "project:project/latest"],
123-
["Search subprojects", "subprojects:project/latest"]
122+
["Include subprojects", "subprojects:project/latest"]
124123
],
125124
"project": "project",
126125
"version": "latest"

readthedocs/proxito/views/hosting.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,17 +398,13 @@ def _v0(self, project, version, build, filename, url, user):
398398
# TODO: figure it out where this data comes from
399399
"filters": [
400400
[
401-
"Search only in this project",
402-
f"project:{project.slug}/{version.slug}",
403-
],
404-
[
405-
"Search subprojects",
401+
"Include subprojects",
406402
f"subprojects:{project.slug}/{version.slug}",
407403
],
408404
]
409405
if version
410406
else [],
411-
"default_filter": f"subprojects:{project.slug}/{version.slug}"
407+
"default_filter": f"project:{project.slug}/{version.slug}"
412408
if version
413409
else None,
414410
},

0 commit comments

Comments
 (0)