Skip to content

Commit

Permalink
issue-302: allow searching within ontology when pressing Search button
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Lagrimas committed Aug 11, 2023
1 parent fb67055 commit d427713
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions frontend/src/components/SearchBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export default function SearchBox({
let autocompleteElements = autocompleteToShow.map(
(autocomplete, i): SearchBoxEntry => {
searchParams.set("q", autocomplete.autosuggest);
if (ontologyId) searchParams.set("ontologyId", ontologyId);
const linkUrl = `/search?${new URLSearchParams(searchParams)}`;
return {
linkUrl,
Expand Down Expand Up @@ -329,6 +330,7 @@ export default function SearchBox({
navigate(allDropdownElements[arrowKeySelectedN].linkUrl);
} else if (query) {
searchParams.set("q", query);
if (ontologyId) searchParams.set("ontologyId", ontologyId);
navigate(`/search?${new URLSearchParams(searchParams)}`);
}
} else if (ev.key === "ArrowDown") {
Expand Down Expand Up @@ -382,6 +384,8 @@ export default function SearchBox({
onClick={() => {
if (query) {
searchParams.set("q", query);
if (ontologyId)
searchParams.set("ontologyId", ontologyId);
navigate(`/search?${new URLSearchParams(searchParams)}`);
}
}}
Expand All @@ -398,6 +402,7 @@ export default function SearchBox({
onClick={() => {
if (query) {
searchParams.set("q", query);
if (ontologyId) searchParams.set("ontologyId", ontologyId);
navigate(`/search?${new URLSearchParams(searchParams)}`);
}
}}
Expand Down

0 comments on commit d427713

Please sign in to comment.