Skip to content

Commit 75f39a0

Browse files
SC84027 | project Filter Is Included In Search Query (#66)
* Add project filter to search_options * Update changelog
1 parent 3e88253 commit 75f39a0

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

.github/CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
## Release 0.9.0 (development release)
1+
## Release 0.9.0
22

33
### Contributors
44

55
This release contains contributions from (in alphabetical order):
66

7+
- [Andrew Gardhouse](https://github.com/AndrewGardhouse)
8+
9+
### Features
10+
11+
- Project filter is now passed to search options when `search_on_pennylane_ai` is `True`
12+
713
## Release 0.8.0
814

915
### Contributors

xanadu_sphinx_theme/search.html

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
{% if theme_search_on_pennylane_ai|lower == 'true' %}
22
<!-- If JavaScript is enabled, redirect users to https://pennylane.ai/search. -->
33
<script type="text/javascript">
4+
const DOC_PROJECTS = [
5+
{ urlPath: '/projects/catalyst/', project: 'catalyst' },
6+
{ urlPath: '/projects/lightning/', project: 'pennylane-lightning' },
7+
{ urlPath: '/projects/qiskit/', project: 'pennylane-qiskit' },
8+
]
9+
410
const search_version = window.location.pathname.includes("/latest/") ? "latest" : "stable";
511
const search_query = new URLSearchParams(window.location.search).get("q") || "";
6-
const search_options = {contentType: "DOC", q: search_query, version: search_version};
12+
const search_project = DOC_PROJECTS.find((project) => {
13+
return window.location.pathname.includes(project.urlPath)
14+
})
15+
const search_options = {
16+
contentType: 'DOC',
17+
q: search_query,
18+
version: search_version,
19+
project: search_project ? search_project.project : 'pennylane',
20+
}
721

822
const redirect_page = "https://pennylane.ai/search";
923
const redirect_query_params = Object.entries(search_options).map(([k, v]) => `${k}=${v}`).join("&");

0 commit comments

Comments
 (0)