feat: integrate native indexer for mobile (#14174)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

* **New Features**
* Added full-text search functionality to mobile apps (Android and iOS),
enabling document indexing and search capabilities.
* Enhanced blob upload support with new GraphQL mutations for creating,
completing, and managing file uploads.

* **Improvements**
* iOS and Android now use SQLite storage backend for improved indexing
performance, aligning with desktop experience.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2025-12-28 21:34:39 +08:00
committed by GitHub
parent 504460438f
commit 20a80015c0
24 changed files with 1993 additions and 39 deletions

View File

@@ -171,7 +171,9 @@ export interface NbStorePlugin {
id: string;
indexName: string;
query: string;
}) => Promise<{ id: string; score: number; terms: Array<string> }[]>;
}) => Promise<{
results: { id: string; score: number; terms: Array<string> }[];
}>;
ftsGetDocument: (options: {
id: string;
indexName: string;
@@ -182,7 +184,7 @@ export interface NbStorePlugin {
indexName: string;
docId: string;
query: string;
}) => Promise<Array<{ start: number; end: number }>>;
}) => Promise<{ matches: { start: number; end: number }[] }>;
ftsFlushIndex: (options: { id: string }) => Promise<void>;
ftsIndexVersion: () => Promise<number>;
ftsIndexVersion: () => Promise<{ indexVersion: number }>;
}

View File

@@ -374,11 +374,12 @@ export const NbStoreNativeDBApis: NativeDBApis = {
indexName: string,
query: string
): Promise<{ id: string; score: number; terms: Array<string> }[]> {
return await NbStore.ftsSearch({
const { results } = await NbStore.ftsSearch({
id,
indexName,
query,
});
return results ?? [];
},
ftsGetDocument: async function (
id: string,
@@ -398,12 +399,13 @@ export const NbStoreNativeDBApis: NativeDBApis = {
docId: string,
query: string
): Promise<{ start: number; end: number }[]> {
return await NbStore.ftsGetMatches({
const { matches } = await NbStore.ftsGetMatches({
id,
indexName,
docId,
query,
});
return matches ?? [];
},
ftsFlushIndex: async function (id: string): Promise<void> {
await NbStore.ftsFlushIndex({
@@ -411,6 +413,6 @@ export const NbStoreNativeDBApis: NativeDBApis = {
});
},
ftsIndexVersion: function (): Promise<number> {
return NbStore.ftsIndexVersion();
return NbStore.ftsIndexVersion().then(res => res.indexVersion);
},
};