Skip to content

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

chore: added option for force reindexing

Ilian Sapundshiev6f7114324523
diff --git a/src/renderer/hooks/LocationIndexContextProvider.tsx b/src/renderer/hooks/LocationIndexContextProvider.tsx
index ed6ef2c83..ee3d153a8 100644
--- a/src/renderer/hooks/LocationIndexContextProvider.tsx
+++ b/src/renderer/hooks/LocationIndexContextProvider.tsx
@@ -378,6 +378,7 @@ export const LocationIndexContextProvider = ({
enableWS = true,
isWalking = () => true,
extractLinks?: boolean,
+ forceFullReindex = false,
): Promise<TS.FileSystemEntry[]> {
if (isWalking()) {
if (Pro && Pro.Watcher) {
@@ -401,6 +402,7 @@ export const LocationIndexContextProvider = ({
extractLinks ?? !!loc.extractLinks,
ignorePatterns,
loc.uuid,
+ forceFullReindex,
)
.then((result) => {
if (result && result.success) {
@@ -424,6 +426,7 @@ export const LocationIndexContextProvider = ({
ignorePatterns,
isWalking,
extractLinks,
+ forceFullReindex,
);
});
}
@@ -435,6 +438,7 @@ export const LocationIndexContextProvider = ({
ignorePatterns,
isWalking,
extractLinks,
+ forceFullReindex,
);
});
}
@@ -550,6 +554,7 @@ export const LocationIndexContextProvider = ({
ignorePatterns: Array<string> = [],
enableWS = true,
extractLinks?: boolean,
+ forceFullReindex = false,
): Promise<any> {
const indexFilePath = getMetaIndexFilePath(param.path);
@@ -561,6 +566,7 @@ export const LocationIndexContextProvider = ({
enableWS,
isWalking,
extractLinks,
+ forceFullReindex,
)
.then((index) => {
deignoreByWatcher(indexFilePath);
@@ -908,6 +914,8 @@ export const LocationIndexContextProvider = ({
currentLocation.fullTextIndex,
currentLocation.ignorePatternPaths,
enableWS,
+ undefined,
+ !!searchQuery.forceIndexing,
);
setIndex(newIndex);
}
@@ -969,6 +977,8 @@ export const LocationIndexContextProvider = ({
location.fullTextIndex,
location.ignorePatternPaths,
enableWS,
+ undefined,
+ !!searchQuery.forceIndexing,
);
}
const results = await getSearchResults(directoryIndex, searchQuery);
diff --git a/src/renderer/utils/CommonLocation.ts b/src/renderer/utils/CommonLocation.ts
index b41c50e1d..09046b880 100644
--- a/src/renderer/utils/CommonLocation.ts
+++ b/src/renderer/utils/CommonLocation.ts
@@ -1063,6 +1063,7 @@ export class CommonLocation implements TS.Location {
extractLinks: boolean,
ignorePatterns: Array<string>,
requestId: string,
+ forceFullReindex: boolean = false,
): Promise<any> => {
/*if (this.isReadOnly) {
return Promise.reject(new Error('read only Location'));
@@ -1077,6 +1078,7 @@ export class CommonLocation implements TS.Location {
extractText,
extractLinks,
ignorePatterns,
+ forceFullReindex,
});
return window.electronIO.ipcRenderer.invoke(
'postRequest',