mirror of
https://github.com/logancyang/obsidian-copilot.git
synced 2026-07-22 07:50:24 +00:00
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:
parent
ce7c51f336
commit
8b43355c77
5 changed files with 35 additions and 2 deletions
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue