fix(search): allow remote backends to re-index on mobile when disableIndexOnMobile is enabled (#2308)

The disableIndexOnMobile guard was blocking all re-indexing on mobile,
including the Miyo backend which is a remote HTTP service with no local
index. Add isRemoteBackend() to SemanticIndexBackend interface so guards
in IndexEventHandler and VectorStoreManager can skip the check for
remote backends.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Wenzheng Jiang 2026-03-17 10:21:38 +09:00 committed by GitHub
parent ce7c51f336
commit 8b43355c77
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 35 additions and 2 deletions

View file

@ -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.
*

View file

@ -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.
*/

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}