TagSpaces is an offline, open source, document manager with tagging support
do not show hidden files in search results if setting is do not show files with dot(.) (#1437)
Stanimirf20ada40971a
diff --git a/app/components/Search.tsx b/app/components/Search.tsxindex adbe8c34e..c3c31fc61 100644--- a/app/components/Search.tsx+++ b/app/components/Search.tsx@@ -63,7 +63,10 @@ import {isIndexing,getSearchQuery} from '../reducers/location-index';-import { getMaxSearchResults } from '-/reducers/settings';+import {+ getMaxSearchResults,+ getShowUnixHiddenEntries+} from '-/reducers/settings';import styles from './SidePanels.css';import i18n from '../services/i18n';import { FileTypeGroups } from '-/services/search';@@ -71,7 +74,6 @@ import { Pro } from '../pro';import SearchMenu from './menus/SearchMenu';import { formatDateTime, extractTimePeriod } from '-/utils/dates';import { isPlusCode, parseLatLon } from '-/utils/misc';-import PlatformIO from '../services/platform-io';import { AppConfig } from '-/config';import { actions as SearchActions, getSearches } from '-/reducers/searches';import { TS } from '-/tagspaces.namespace';@@ -97,6 +99,7 @@ interface Props {indexing: boolean;searches: Array<TS.SearchQuery>;addSearches: (searches: Array<TS.SearchQuery>) => void;+ showUnixHiddenEntries: boolean;}const Search = React.memo((props: Props) => {@@ -193,7 +196,8 @@ const Search = React.memo((props: Props) => {if (searchBoxing.current !== 'global') {props.searchLocationIndex({...props.searchQuery,- fileTypes: types+ fileTypes: types,+ showUnixHiddenEntries: props.showUnixHiddenEntries});}}@@ -208,7 +212,8 @@ const Search = React.memo((props: Props) => {if (searchBoxing.current !== 'global') {props.searchLocationIndex({...props.searchQuery,- fileSize: value+ fileSize: value,+ showUnixHiddenEntries: props.showUnixHiddenEntries});}}@@ -225,7 +230,8 @@ const Search = React.memo((props: Props) => {if (searchBoxing.current !== 'global') {props.searchLocationIndex({...props.searchQuery,- lastModified: value+ lastModified: value,+ showUnixHiddenEntries: props.showUnixHiddenEntries});}}@@ -263,9 +269,15 @@ const Search = React.memo((props: Props) => {}if (savedSearch.searchBoxing === 'global') {- props.searchAllLocations(savedSearch);+ props.searchAllLocations({+ ...savedSearch,+ showUnixHiddenEntries: props.showUnixHiddenEntries+ });} else {- props.searchLocationIndex(savedSearch);+ props.searchLocationIndex({+ ...savedSearch,+ showUnixHiddenEntries: props.showUnixHiddenEntries+ });}};@@ -308,7 +320,10 @@ const Search = React.memo((props: Props) => {searchQuery = { ...props.searchQuery, tagsOR: value };}}- props.searchLocationIndex(searchQuery);+ props.searchLocationIndex({+ ...searchQuery,+ showUnixHiddenEntries: props.showUnixHiddenEntries+ });// if (searchBoxing !== 'global') { // TODO disable automatic search in global mode//// }@@ -557,7 +572,8 @@ const Search = React.memo((props: Props) => {// tagPlaceRadius,maxSearchResults: props.maxSearchResults,currentDirectory: props.currentDirectory,- forceIndexing: forceIndexing.current+ forceIndexing: forceIndexing.current,+ showUnixHiddenEntries: props.showUnixHiddenEntries};console.log('Search object: ' + JSON.stringify(searchQuery));if (searchBoxing.current === 'global') {@@ -1150,9 +1166,15 @@ const Search = React.memo((props: Props) => {setSaveSearchDialogOpened(undefined);if (searchQuery) {if (searchQuery.searchBoxing === 'global') {- props.searchAllLocations(searchQuery);+ props.searchAllLocations({+ ...searchQuery,+ showUnixHiddenEntries: props.showUnixHiddenEntries+ });} else {- props.searchLocationIndex(searchQuery);+ props.searchLocationIndex({+ ...searchQuery,+ showUnixHiddenEntries: props.showUnixHiddenEntries+ });}}}}@@ -1197,7 +1219,8 @@ function mapStateToProps(state) {currentDirectory: getDirectoryPath(state),indexedEntriesCount: getIndexedEntriesCount(state),maxSearchResults: getMaxSearchResults(state),- searches: getSearches(state)+ searches: getSearches(state),+ showUnixHiddenEntries: getShowUnixHiddenEntries(state)};}diff --git a/app/services/search.ts b/app/services/search.tsindex 2aa489ebd..7cdf620a1 100644--- a/app/services/search.ts+++ b/app/services/search.ts@@ -291,7 +291,11 @@ export default class Search {new Promise(resolve => {console.time('searchtime');const jmespathQuery = constructjmespathQuery(searchQuery);- let results = prepareIndex(locationContent);+ let results = prepareIndex(+ !searchQuery.showUnixHiddenEntries+ ? locationContent.filter(entry => !entry.name.startsWith('.'))+ : locationContent+ );let searched = false;// Limiting the search to current folder only (with sub-folders)diff --git a/app/tagspaces.namespace.d.ts b/app/tagspaces.namespace.d.tsindex 77cb71fea..09708ddb4 100644--- a/app/tagspaces.namespace.d.ts+++ b/app/tagspaces.namespace.d.ts@@ -63,6 +63,7 @@ export namespace TS {tagPlaceLong?: number | null;tagPlaceRadius?: number | null;maxSearchResults?: number;+ showUnixHiddenEntries?: boolean;}type Uuid = string;