Skip to content

Commit 581664c

Browse files
authored
Merge pull request #829 from navikt/log-search-string-when-added
Logger search string når man legger det inn i combobox
2 parents 5bbe2a3 + 33e0948 commit 581664c

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/app/(sok)/_components/searchBox/SearchCombobox.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import useQuery from "@/app/(sok)/_components/QueryProvider";
55
import { QueryNames } from "@/app/(sok)/_utils/QueryNames";
66
import { findLabelForFilter, getSearchBoxOptions } from "@/app/(sok)/_components/searchBox/buildSearchBoxOptions";
77
import logAmplitudeEvent, { logFilterChanged } from "@/app/_common/monitoring/amplitude";
8+
import { logSearchString } from "@/app/_common/monitoring/search-logging";
89

910
function SearchCombobox({ aggregations, locations }) {
1011
const [showComboboxList, setShowComboboxList] = useState(undefined);
@@ -33,6 +34,7 @@ function SearchCombobox({ aggregations, locations }) {
3334
const handleFreeTextSearchOption = (value, isSelected) => {
3435
if (isSelected) {
3536
query.append(QueryNames.SEARCH_STRING, value);
37+
logSearchString(value);
3638
logAmplitudeEvent("Text searched", { searchTerm: "Add" });
3739
} else {
3840
query.remove(QueryNames.SEARCH_STRING, value);

src/app/_common/monitoring/search-logging.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ export async function logSearch(rating, rawSearchParams) {
1010
loggerWithoutCallId.info(`[rating search params] ${JSON.stringify(metadata)}`);
1111
}
1212

13+
export async function logSearchString(searchString) {
14+
loggerWithoutCallId.info(`[search string] ${searchString}`);
15+
}
16+
1317
export async function logTextSearch(rawSearchParams) {
1418
const searchParams = removeUnknownSearchParams(rawSearchParams);
1519

0 commit comments

Comments
 (0)