diff --git a/src/search/indexBackend/MiyoIndexBackend.ts b/src/search/indexBackend/MiyoIndexBackend.ts index 97fcc979..e08ace73 100644 --- a/src/search/indexBackend/MiyoIndexBackend.ts +++ b/src/search/indexBackend/MiyoIndexBackend.ts @@ -274,6 +274,15 @@ export class MiyoIndexBackend implements SemanticIndexBackend { return; } + /** + * Miyo is a remote HTTP backend with no local index. + * + * @returns True because Miyo sends data to a remote service. + */ + public isRemoteBackend(): boolean { + return true; + } + /** * Resolve the Miyo base URL using settings and discovery. * diff --git a/src/search/indexBackend/OramaIndexBackend.ts b/src/search/indexBackend/OramaIndexBackend.ts index a201e175..1d88238d 100644 --- a/src/search/indexBackend/OramaIndexBackend.ts +++ b/src/search/indexBackend/OramaIndexBackend.ts @@ -185,6 +185,15 @@ export class OramaIndexBackend implements SemanticIndexBackend { this.dbOps.onunload(); } + /** + * Orama uses a local index, so it is not a remote backend. + * + * @returns False because Orama stores data locally. + */ + public isRemoteBackend(): boolean { + return false; + } + /** * Return the underlying Orama database instance when available. */ diff --git a/src/search/indexBackend/SemanticIndexBackend.ts b/src/search/indexBackend/SemanticIndexBackend.ts index 45d272ff..bef235dd 100644 --- a/src/search/indexBackend/SemanticIndexBackend.ts +++ b/src/search/indexBackend/SemanticIndexBackend.ts @@ -122,4 +122,11 @@ export interface SemanticIndexBackend { * Flush or persist any pending backend work before unload. */ onunload(): void; + + /** + * Return true when this backend is remote (e.g. Miyo) and does not use a local index. + * Used to bypass the `disableIndexOnMobile` guard for remote backends that have no + * local storage concerns. + */ + isRemoteBackend(): boolean; } diff --git a/src/search/indexEventHandler.ts b/src/search/indexEventHandler.ts index 03ce94f3..68ab7028 100644 --- a/src/search/indexEventHandler.ts +++ b/src/search/indexEventHandler.ts @@ -72,7 +72,11 @@ export class IndexEventHandler { if (!this.shouldHandleEvents()) { return; } - if (Platform.isMobile && getSettings().disableIndexOnMobile) { + if ( + Platform.isMobile && + getSettings().disableIndexOnMobile && + !this.indexBackend.isRemoteBackend() + ) { return; } diff --git a/src/search/vectorStoreManager.ts b/src/search/vectorStoreManager.ts index f5b30932..97a344aa 100644 --- a/src/search/vectorStoreManager.ts +++ b/src/search/vectorStoreManager.ts @@ -130,7 +130,11 @@ export default class VectorStoreManager { return 0; } - if (Platform.isMobile && getSettings().disableIndexOnMobile) { + if ( + Platform.isMobile && + getSettings().disableIndexOnMobile && + !this.indexBackend.isRemoteBackend() + ) { new Notice("Indexing is disabled on mobile devices"); return 0; }