Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix search query (#1551)

Stanimir95b70d91c455
diff --git a/app/components/SearchInline.tsx b/app/components/SearchInline.tsx
index 833d71cb5..45a486443 100644
--- a/app/components/SearchInline.tsx
+++ b/app/components/SearchInline.tsx
@@ -43,7 +43,7 @@ import { TS } from '-/tagspaces.namespace';
import {
escapeRegExp,
parseTextQuery,
- removeAllTagsFromQuery
+ removeAllTagsFromSearchQuery
} from '-/utils/misc';
import useFirstRender from '-/utils/useFirstRender';
@@ -194,7 +194,7 @@ const SearchInline = (props: Props) => {
});
emptySearch = false;
}
- const txtQuery = removeAllTagsFromQuery(textQuery.current);
+ const txtQuery = removeAllTagsFromSearchQuery(textQuery.current);
if (txtQuery) {
emptySearch = false;
}
@@ -214,10 +214,8 @@ const SearchInline = (props: Props) => {
} else {
txtQuery = props.searchQuery.textQuery || '';
}
-
- const withMask = txtQuery + ' ' + tagsMask.trim();
- if (withMask !== textQuery.current) {
- textQuery.current = withMask; */
+ */
+ textQuery.current = txtQuery + ' ' + textQueryMask.current.trim();
mainSearchField.current.value =
txtQuery +
(textQueryMask.current ? ' ' + textQueryMask.current.trim() : '');
diff --git a/app/utils/misc.ts b/app/utils/misc.ts
index 8eb2368e5..616f55b35 100644
--- a/app/utils/misc.ts
+++ b/app/utils/misc.ts
@@ -105,14 +105,12 @@ export function parseTextQuery(textQuery: string, identifier: string) {
return extractedTags;
}
-export function removeAllTagsFromQuery(query: string) {
+export function removeAllTagsFromSearchQuery(query: string) {
if (!query) {
return '';
}
- if (query && query.indexOf('[') > -1) {
- return query.replace(/([+-?]\S+)/g, '').trim();
- }
- return query;
+ // if (query && query.indexOf('[') > -1) {
+ return query.replace(/([+-?]\S+)/g, '').trim();
}
export function mergeWithExtractedTags(