Fix global search "view all results" omitting notes matches (#12482) (#12832)

The search drawer searches notes when the notes-search setting is
enabled, but the "view all results" link only carried the plain
search term - so results that matched only via their notes were
missing from the full results table.

Pass the search_notes flag through to the overview table URL when
notes search is active; the table forwards URL query parameters to
the API, where InvenTreeSearchFilter already supports search_notes.
This commit is contained in:
wyyd-yxc
2026-09-12 14:12:30 +10:00
committed by GitHub
parent 0bf4fffb39
commit 27f89d25a3
@@ -78,7 +78,8 @@ function QueryResultGroup({
navigate,
onClose,
onRemove,
onResultClick
onResultClick,
searchNotes
}: Readonly<{
searchText: string;
query: SearchQuery;
@@ -86,6 +87,7 @@ function QueryResultGroup({
onClose: () => void;
onRemove: (query: ModelType) => void;
onResultClick: (query: ModelType, pk: number, event: any) => void;
searchNotes: boolean;
}>) {
const modelInfo = useMemo(() => getModelInfo(query.model), [query.model]);
@@ -104,7 +106,11 @@ function QueryResultGroup({
cancelEvent(event);
if (overviewUrl) {
const url = `${overviewUrl}?search=${searchText}`;
// Keep the notes-search context so results found via their notes
// are also present in the full results table view
const url = `${overviewUrl}?search=${searchText}${
searchNotes ? '&search_notes=true' : ''
}`;
// Close drawer if opening in the same tab
if (!eventModified(event)) {
@@ -121,7 +127,7 @@ function QueryResultGroup({
});
}
},
[overviewUrl, searchText]
[overviewUrl, searchText, searchNotes]
);
if (query.results.count == 0) {
@@ -592,6 +598,7 @@ export function SearchDrawer({
query={query}
navigate={navigate}
onClose={closeDrawer}
searchNotes={searchNotes}
onRemove={(query) => removeResults(query)}
onResultClick={(query, pk, event) =>
onResultClick(query, pk, event)