@nebutra/search 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -77
- package/dist/factory.d.ts +3 -11
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +4 -58
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -6
- package/dist/types.d.ts +4 -35
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -21
- package/dist/providers/algolia.d.ts +0 -20
- package/dist/providers/algolia.d.ts.map +0 -1
- package/dist/providers/algolia.js +0 -297
- package/dist/providers/meilisearch.d.ts +0 -17
- package/dist/providers/meilisearch.d.ts.map +0 -1
- package/dist/providers/meilisearch.js +0 -279
- package/dist/providers/typesense.d.ts +0 -22
- package/dist/providers/typesense.d.ts.map +0 -1
- package/dist/providers/typesense.js +0 -352
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
> **Status: Foundation** — Type definitions, factory pattern, and provider
|
|
1
|
+
> **Status: Foundation** — Type definitions, factory pattern, and the pgvector provider are complete. See inline TODOs for integration points.
|
|
2
2
|
|
|
3
3
|
# @nebutra/search
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Single-provider full-text + vector search package for Nebutra-Sailor: **pgvector** (Postgres + the `pgvector` extension) — BM25 keyword search and vector cosine search over your own Postgres, with no external search infra to operate.
|
|
6
6
|
|
|
7
7
|
## Quick Start
|
|
8
8
|
|
|
@@ -17,7 +17,7 @@ pnpm add @nebutra/search
|
|
|
17
17
|
```typescript
|
|
18
18
|
import { getSearch } from "@nebutra/search";
|
|
19
19
|
|
|
20
|
-
// Auto-detects provider from
|
|
20
|
+
// Auto-detects the pgvector provider from DATABASE_URL
|
|
21
21
|
const search = await getSearch();
|
|
22
22
|
|
|
23
23
|
// Index a document
|
|
@@ -41,65 +41,23 @@ const results = await search.search("products", {
|
|
|
41
41
|
await search.deleteDocument("products", "prod_123", "org_456");
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
## Provider
|
|
44
|
+
## Provider Configuration
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
| Priority | Env Variable | Provider |
|
|
49
|
-
|----------|---|---|
|
|
50
|
-
| 1 | `SEARCH_PROVIDER` | As specified |
|
|
51
|
-
| 2 | `MEILISEARCH_URL` | meilisearch |
|
|
52
|
-
| 3 | `TYPESENSE_URL` | typesense |
|
|
53
|
-
| 4 | `ALGOLIA_APP_ID` | algolia |
|
|
54
|
-
| 5 | — | meilisearch (default) |
|
|
55
|
-
|
|
56
|
-
### Meilisearch Setup
|
|
46
|
+
`pgvector` is the only supported provider. It reads `DATABASE_URL` by default, or accepts an explicit config:
|
|
57
47
|
|
|
58
48
|
```bash
|
|
59
49
|
# .env
|
|
60
|
-
|
|
61
|
-
MEILISEARCH_API_KEY=your-api-key
|
|
50
|
+
DATABASE_URL=postgres://localhost/nebutra
|
|
62
51
|
```
|
|
63
52
|
|
|
64
53
|
```typescript
|
|
65
|
-
|
|
66
|
-
provider: "meilisearch",
|
|
67
|
-
url: "http://localhost:7700",
|
|
68
|
-
apiKey: process.env.MEILISEARCH_API_KEY,
|
|
69
|
-
});
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Typesense Setup
|
|
54
|
+
import { createSearch } from "@nebutra/search";
|
|
73
55
|
|
|
74
|
-
```bash
|
|
75
|
-
# .env
|
|
76
|
-
TYPESENSE_URL=http://localhost:8108
|
|
77
|
-
TYPESENSE_API_KEY=your-api-key
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
```typescript
|
|
81
56
|
const search = await createSearch({
|
|
82
|
-
provider: "
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### Algolia Setup
|
|
89
|
-
|
|
90
|
-
```bash
|
|
91
|
-
# .env
|
|
92
|
-
ALGOLIA_APP_ID=your-app-id
|
|
93
|
-
ALGOLIA_SEARCH_KEY=your-search-key
|
|
94
|
-
ALGOLIA_ADMIN_KEY=your-admin-key
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
```typescript
|
|
98
|
-
const search = await createSearch({
|
|
99
|
-
provider: "algolia",
|
|
100
|
-
appId: process.env.ALGOLIA_APP_ID,
|
|
101
|
-
searchKey: process.env.ALGOLIA_SEARCH_KEY,
|
|
102
|
-
adminKey: process.env.ALGOLIA_ADMIN_KEY,
|
|
57
|
+
provider: "pgvector",
|
|
58
|
+
connectionString: process.env.DATABASE_URL,
|
|
59
|
+
embeddingDim: 1536, // defaults to 1536 (OpenAI text-embedding-3-small)
|
|
60
|
+
tablePrefix: "nebutra_search", // defaults to "nebutra_search"
|
|
103
61
|
});
|
|
104
62
|
```
|
|
105
63
|
|
|
@@ -198,7 +156,7 @@ await search.createIndex("products", {
|
|
|
198
156
|
|
|
199
157
|
### `updateSettings(index, settings)`
|
|
200
158
|
|
|
201
|
-
Update index settings
|
|
159
|
+
Update index settings.
|
|
202
160
|
|
|
203
161
|
```typescript
|
|
204
162
|
await search.updateSettings("products", {
|
|
@@ -216,7 +174,7 @@ await search.close();
|
|
|
216
174
|
|
|
217
175
|
## Multi-Tenancy
|
|
218
176
|
|
|
219
|
-
|
|
177
|
+
The pgvector provider supports tenant isolation via `tenantId`:
|
|
220
178
|
|
|
221
179
|
```typescript
|
|
222
180
|
// Index with tenant
|
|
@@ -238,21 +196,17 @@ await search.deleteByFilter("products", {
|
|
|
238
196
|
});
|
|
239
197
|
```
|
|
240
198
|
|
|
241
|
-
**Under the hood:**
|
|
242
|
-
- **Meilisearch** / **Typesense**: Separate indices per tenant (e.g., `products__org_456`)
|
|
243
|
-
- **Algolia**: Facet-based filtering within shared indices
|
|
199
|
+
**Under the hood:** `pgvector` filters by a `tenant_id` column on the shared table for each index (table named `<prefix>_<index>`).
|
|
244
200
|
|
|
245
|
-
## Direct Provider
|
|
201
|
+
## Direct Provider Import
|
|
246
202
|
|
|
247
203
|
For advanced use or testing:
|
|
248
204
|
|
|
249
205
|
```typescript
|
|
250
|
-
import {
|
|
251
|
-
import { TypesenseProvider } from "@nebutra/search/typesense";
|
|
252
|
-
import { AlgoliaProvider } from "@nebutra/search/algolia";
|
|
206
|
+
import { PgvectorProvider } from "@nebutra/search/pgvector";
|
|
253
207
|
|
|
254
208
|
// Use directly
|
|
255
|
-
const search = new
|
|
209
|
+
const search = new PgvectorProvider({ provider: "pgvector" });
|
|
256
210
|
```
|
|
257
211
|
|
|
258
212
|
## Type Safety
|
|
@@ -275,21 +229,11 @@ Uses `@nebutra/logger` for structured logging. All operations log at debug level
|
|
|
275
229
|
## Environment Variables
|
|
276
230
|
|
|
277
231
|
```bash
|
|
278
|
-
# Provider selection (optional)
|
|
279
|
-
SEARCH_PROVIDER=
|
|
280
|
-
|
|
281
|
-
# Meilisearch
|
|
282
|
-
MEILISEARCH_URL=http://localhost:7700
|
|
283
|
-
MEILISEARCH_API_KEY=xyz
|
|
284
|
-
|
|
285
|
-
# Typesense
|
|
286
|
-
TYPESENSE_URL=http://localhost:8108
|
|
287
|
-
TYPESENSE_API_KEY=xyz
|
|
232
|
+
# Provider selection (optional — pgvector is the only supported provider)
|
|
233
|
+
SEARCH_PROVIDER=pgvector
|
|
288
234
|
|
|
289
|
-
#
|
|
290
|
-
|
|
291
|
-
ALGOLIA_SEARCH_KEY=xyz
|
|
292
|
-
ALGOLIA_ADMIN_KEY=xyz
|
|
235
|
+
# pgvector
|
|
236
|
+
DATABASE_URL=postgres://localhost/nebutra
|
|
293
237
|
```
|
|
294
238
|
|
|
295
239
|
## Testing
|
package/dist/factory.d.ts
CHANGED
|
@@ -7,18 +7,10 @@ import type { SearchConfig, SearchProvider } from "./types";
|
|
|
7
7
|
* // Auto-detect from environment
|
|
8
8
|
* const search = await createSearch();
|
|
9
9
|
*
|
|
10
|
-
* // Explicit
|
|
10
|
+
* // Explicit pgvector
|
|
11
11
|
* const search = await createSearch({
|
|
12
|
-
* provider: "
|
|
13
|
-
*
|
|
14
|
-
* });
|
|
15
|
-
*
|
|
16
|
-
* // Explicit Algolia
|
|
17
|
-
* const search = await createSearch({
|
|
18
|
-
* provider: "algolia",
|
|
19
|
-
* appId: "YOUR_APP_ID",
|
|
20
|
-
* searchKey: "YOUR_SEARCH_KEY",
|
|
21
|
-
* adminKey: "YOUR_ADMIN_KEY",
|
|
12
|
+
* provider: "pgvector",
|
|
13
|
+
* connectionString: "postgres://localhost/nebutra",
|
|
22
14
|
* });
|
|
23
15
|
* ```
|
|
24
16
|
*/
|
package/dist/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAsB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAsB,MAAM,SAAS,CAAC;AAsBhF;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,YAAY,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CA6BjF;AAED;;;GAGG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,cAAc,CAAC,CAKzD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAExD;AAED;;GAEG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAKjD"}
|
package/dist/factory.js
CHANGED
|
@@ -14,17 +14,7 @@ let defaultProvider = null;
|
|
|
14
14
|
* Detect which provider to use based on available environment variables.
|
|
15
15
|
*/
|
|
16
16
|
function detectProvider() {
|
|
17
|
-
|
|
18
|
-
return "meilisearch";
|
|
19
|
-
if (process.env.TYPESENSE_URL)
|
|
20
|
-
return "typesense";
|
|
21
|
-
if (process.env.ALGOLIA_APP_ID)
|
|
22
|
-
return "algolia";
|
|
23
|
-
// Only fall back to pgvector when DATABASE_URL is set — otherwise default to
|
|
24
|
-
// meilisearch (developer-friendly local default).
|
|
25
|
-
if (process.env.SEARCH_PROVIDER === "pgvector" && process.env.DATABASE_URL)
|
|
26
|
-
return "pgvector";
|
|
27
|
-
return "meilisearch";
|
|
17
|
+
return "pgvector";
|
|
28
18
|
}
|
|
29
19
|
/**
|
|
30
20
|
* Create a search provider instance.
|
|
@@ -34,18 +24,10 @@ function detectProvider() {
|
|
|
34
24
|
* // Auto-detect from environment
|
|
35
25
|
* const search = await createSearch();
|
|
36
26
|
*
|
|
37
|
-
* // Explicit
|
|
27
|
+
* // Explicit pgvector
|
|
38
28
|
* const search = await createSearch({
|
|
39
|
-
* provider: "
|
|
40
|
-
*
|
|
41
|
-
* });
|
|
42
|
-
*
|
|
43
|
-
* // Explicit Algolia
|
|
44
|
-
* const search = await createSearch({
|
|
45
|
-
* provider: "algolia",
|
|
46
|
-
* appId: "YOUR_APP_ID",
|
|
47
|
-
* searchKey: "YOUR_SEARCH_KEY",
|
|
48
|
-
* adminKey: "YOUR_ADMIN_KEY",
|
|
29
|
+
* provider: "pgvector",
|
|
30
|
+
* connectionString: "postgres://localhost/nebutra",
|
|
49
31
|
* });
|
|
50
32
|
* ```
|
|
51
33
|
*/
|
|
@@ -55,42 +37,6 @@ export async function createSearch(config) {
|
|
|
55
37
|
detectProvider();
|
|
56
38
|
logger.info("[search] Creating provider", { provider: providerType });
|
|
57
39
|
switch (providerType) {
|
|
58
|
-
case "meilisearch": {
|
|
59
|
-
const { MeilisearchProvider } = await import("./providers/meilisearch");
|
|
60
|
-
const meilisearchConfig = config;
|
|
61
|
-
const configObj = { provider: "meilisearch" };
|
|
62
|
-
if (meilisearchConfig?.url !== undefined)
|
|
63
|
-
configObj.url = meilisearchConfig.url;
|
|
64
|
-
if (meilisearchConfig?.apiKey !== undefined)
|
|
65
|
-
configObj.apiKey = meilisearchConfig.apiKey;
|
|
66
|
-
if (meilisearchConfig?.timeout !== undefined)
|
|
67
|
-
configObj.timeout = meilisearchConfig.timeout;
|
|
68
|
-
return new MeilisearchProvider(configObj);
|
|
69
|
-
}
|
|
70
|
-
case "typesense": {
|
|
71
|
-
const { TypesenseProvider } = await import("./providers/typesense");
|
|
72
|
-
const typesenseConfig = config;
|
|
73
|
-
const configObj = { provider: "typesense" };
|
|
74
|
-
if (typesenseConfig?.url !== undefined)
|
|
75
|
-
configObj.url = typesenseConfig.url;
|
|
76
|
-
if (typesenseConfig?.apiKey !== undefined)
|
|
77
|
-
configObj.apiKey = typesenseConfig.apiKey;
|
|
78
|
-
if (typesenseConfig?.timeout !== undefined)
|
|
79
|
-
configObj.timeout = typesenseConfig.timeout;
|
|
80
|
-
return new TypesenseProvider(configObj);
|
|
81
|
-
}
|
|
82
|
-
case "algolia": {
|
|
83
|
-
const { AlgoliaProvider } = await import("./providers/algolia");
|
|
84
|
-
const algoliaConfig = config;
|
|
85
|
-
const configObj = { provider: "algolia" };
|
|
86
|
-
if (algoliaConfig?.appId !== undefined)
|
|
87
|
-
configObj.appId = algoliaConfig.appId;
|
|
88
|
-
if (algoliaConfig?.searchKey !== undefined)
|
|
89
|
-
configObj.searchKey = algoliaConfig.searchKey;
|
|
90
|
-
if (algoliaConfig?.adminKey !== undefined)
|
|
91
|
-
configObj.adminKey = algoliaConfig.adminKey;
|
|
92
|
-
return new AlgoliaProvider(configObj);
|
|
93
|
-
}
|
|
94
40
|
case "pgvector": {
|
|
95
41
|
const { PgvectorProvider } = await import("./providers/pgvector");
|
|
96
42
|
const pgvectorConfig = config;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export { closeSearch, createSearch, getSearch, setSearch } from "./factory";
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export { TypesenseProvider } from "./providers/typesense";
|
|
5
|
-
export type { AlgoliaConfig, IndexSettings, MeilisearchConfig, SearchConfig, SearchDocument, SearchHit, SearchProvider, SearchProviderType, SearchQuery, SearchResult, TypesenseConfig, } from "./types";
|
|
2
|
+
export { PgvectorProvider } from "./providers/pgvector";
|
|
3
|
+
export type { IndexSettings, PgvectorConfig, SearchConfig, SearchDocument, SearchHit, SearchProvider, SearchProviderType, SearchQuery, SearchResult, } from "./types";
|
|
6
4
|
export { SearchDocumentSchema, SearchQuerySchema } from "./types";
|
|
7
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGxD,YAAY,EACV,aAAa,EACb,cAAc,EACd,YAAY,EACZ,cAAc,EACd,SAAS,EACT,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
// @nebutra/search — Provider-agnostic full-text search
|
|
3
3
|
// =============================================================================
|
|
4
4
|
// Supports:
|
|
5
|
-
// -
|
|
6
|
-
// - Typesense (self-hosted, geo + instant faceting)
|
|
7
|
-
// - Algolia (managed SaaS, zero-ops)
|
|
5
|
+
// - pgvector (Postgres + pgvector extension; BM25 + vector search)
|
|
8
6
|
//
|
|
9
7
|
// Usage:
|
|
10
8
|
// import { getSearch } from "@nebutra/search";
|
|
@@ -16,7 +14,5 @@
|
|
|
16
14
|
// ── Factory ─────────────────────────────────────────────────────────────────
|
|
17
15
|
export { closeSearch, createSearch, getSearch, setSearch } from "./factory";
|
|
18
16
|
// ── Providers (tree-shakable direct imports) ────────────────────────────────
|
|
19
|
-
export {
|
|
20
|
-
export { MeilisearchProvider } from "./providers/meilisearch";
|
|
21
|
-
export { TypesenseProvider } from "./providers/typesense";
|
|
17
|
+
export { PgvectorProvider } from "./providers/pgvector";
|
|
22
18
|
export { SearchDocumentSchema, SearchQuerySchema } from "./types";
|
package/dist/types.d.ts
CHANGED
|
@@ -2,15 +2,11 @@ import { z } from "zod";
|
|
|
2
2
|
/**
|
|
3
3
|
* Supported search backend providers.
|
|
4
4
|
*
|
|
5
|
-
* - `meilisearch` — Self-hosted, developer-friendly, typo-tolerant
|
|
6
|
-
* - `typesense` — Self-hosted, optimised for geo search and faceting
|
|
7
|
-
* - `algolia` — Managed SaaS, zero-ops, global CDN
|
|
8
5
|
* - `pgvector` — Postgres + pgvector extension; BM25 keyword + vector
|
|
9
|
-
* cosine search.
|
|
10
|
-
*
|
|
11
|
-
* infra to operate).
|
|
6
|
+
* cosine search. AI/RAG over your own Postgres, no
|
|
7
|
+
* external search infra to operate.
|
|
12
8
|
*/
|
|
13
|
-
export type SearchProviderType = "
|
|
9
|
+
export type SearchProviderType = "pgvector";
|
|
14
10
|
/**
|
|
15
11
|
* A document that can be indexed by the search provider.
|
|
16
12
|
* All documents must have an id; tenantId is optional for multi-tenancy.
|
|
@@ -117,33 +113,6 @@ export interface IndexSettings {
|
|
|
117
113
|
/** Synonyms for the index (e.g., { "dashboard": ["overview", "analytics"] }) */
|
|
118
114
|
synonyms?: Record<string, string[]>;
|
|
119
115
|
}
|
|
120
|
-
export interface MeilisearchConfig {
|
|
121
|
-
provider: "meilisearch";
|
|
122
|
-
/** Meilisearch server URL (defaults to `process.env.MEILISEARCH_URL`) */
|
|
123
|
-
url?: string;
|
|
124
|
-
/** API key with at least search + indexing permissions (defaults to `process.env.MEILISEARCH_API_KEY`) */
|
|
125
|
-
apiKey?: string;
|
|
126
|
-
/** Default timeout for requests (in milliseconds, default: 30000) */
|
|
127
|
-
timeout?: number;
|
|
128
|
-
}
|
|
129
|
-
export interface TypesenseConfig {
|
|
130
|
-
provider: "typesense";
|
|
131
|
-
/** Typesense server URL (defaults to `process.env.TYPESENSE_URL`) */
|
|
132
|
-
url?: string;
|
|
133
|
-
/** API key for authentication (defaults to `process.env.TYPESENSE_API_KEY`) */
|
|
134
|
-
apiKey?: string;
|
|
135
|
-
/** Default timeout for requests (in milliseconds, default: 30000) */
|
|
136
|
-
timeout?: number;
|
|
137
|
-
}
|
|
138
|
-
export interface AlgoliaConfig {
|
|
139
|
-
provider: "algolia";
|
|
140
|
-
/** Algolia app ID (defaults to `process.env.ALGOLIA_APP_ID`) */
|
|
141
|
-
appId?: string;
|
|
142
|
-
/** Algolia search API key (defaults to `process.env.ALGOLIA_SEARCH_KEY`) */
|
|
143
|
-
searchKey?: string;
|
|
144
|
-
/** Algolia admin API key for indexing (defaults to `process.env.ALGOLIA_ADMIN_KEY`) */
|
|
145
|
-
adminKey?: string;
|
|
146
|
-
}
|
|
147
116
|
export interface PgvectorConfig {
|
|
148
117
|
provider: "pgvector";
|
|
149
118
|
/** Postgres connection string (defaults to `process.env.DATABASE_URL`) */
|
|
@@ -159,5 +128,5 @@ export interface PgvectorConfig {
|
|
|
159
128
|
*/
|
|
160
129
|
tablePrefix?: string;
|
|
161
130
|
}
|
|
162
|
-
export type SearchConfig =
|
|
131
|
+
export type SearchConfig = PgvectorConfig;
|
|
163
132
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAA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IAE9B,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAExB,gFAAgF;IAChF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACrC;AAID,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,UAAU,CAAC;IAErB,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nebutra/search",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -9,10 +9,7 @@
|
|
|
9
9
|
"status": "foundation",
|
|
10
10
|
"productionReady": false,
|
|
11
11
|
"requires": [
|
|
12
|
-
"
|
|
13
|
-
"or TYPESENSE_HOST + TYPESENSE_API_KEY",
|
|
14
|
-
"or ALGOLIA_APP_ID + ALGOLIA_ADMIN_API_KEY",
|
|
15
|
-
"or DATABASE_URL (Postgres + pgvector extension)"
|
|
12
|
+
"DATABASE_URL (Postgres + pgvector extension)"
|
|
16
13
|
],
|
|
17
14
|
"gaps": [
|
|
18
15
|
"Provider adapters are stubs — need bulk index + faceted search",
|
|
@@ -26,18 +23,6 @@
|
|
|
26
23
|
"types": "./dist/index.d.ts",
|
|
27
24
|
"import": "./dist/index.js"
|
|
28
25
|
},
|
|
29
|
-
"./meilisearch": {
|
|
30
|
-
"types": "./dist/providers/meilisearch.d.ts",
|
|
31
|
-
"import": "./dist/providers/meilisearch.js"
|
|
32
|
-
},
|
|
33
|
-
"./typesense": {
|
|
34
|
-
"types": "./dist/providers/typesense.d.ts",
|
|
35
|
-
"import": "./dist/providers/typesense.js"
|
|
36
|
-
},
|
|
37
|
-
"./algolia": {
|
|
38
|
-
"types": "./dist/providers/algolia.d.ts",
|
|
39
|
-
"import": "./dist/providers/algolia.js"
|
|
40
|
-
},
|
|
41
26
|
"./pgvector": {
|
|
42
27
|
"types": "./dist/providers/pgvector.d.ts",
|
|
43
28
|
"import": "./dist/providers/pgvector.js"
|
|
@@ -48,12 +33,9 @@
|
|
|
48
33
|
"README.md"
|
|
49
34
|
],
|
|
50
35
|
"dependencies": {
|
|
51
|
-
"meilisearch": "^0.44.1",
|
|
52
|
-
"typesense": "^2.0.0",
|
|
53
|
-
"algoliasearch": "^5.20.0",
|
|
54
36
|
"pg": "^8.13.1",
|
|
55
37
|
"zod": "^4.3.6",
|
|
56
|
-
"@nebutra/logger": "
|
|
38
|
+
"@nebutra/logger": "3.0.0"
|
|
57
39
|
},
|
|
58
40
|
"devDependencies": {
|
|
59
41
|
"@types/pg": "^8.11.10",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { AlgoliaConfig, IndexSettings, SearchDocument, SearchProvider, SearchQuery, SearchResult } from "../types";
|
|
2
|
-
export declare class AlgoliaProvider implements SearchProvider {
|
|
3
|
-
readonly name = "algolia";
|
|
4
|
-
private searchClient;
|
|
5
|
-
private adminClient;
|
|
6
|
-
constructor(config?: AlgoliaConfig);
|
|
7
|
-
indexDocument<T extends SearchDocument>(index: string, doc: T): Promise<void>;
|
|
8
|
-
indexDocuments<T extends SearchDocument>(index: string, docs: T[]): Promise<void>;
|
|
9
|
-
search<T extends SearchDocument = SearchDocument>(index: string, query: SearchQuery): Promise<SearchResult<T>>;
|
|
10
|
-
deleteDocument(index: string, docId: string, tenantId?: string): Promise<void>;
|
|
11
|
-
deleteByFilter(index: string, filters: Record<string, string | number | boolean>): Promise<void>;
|
|
12
|
-
createIndex(index: string, settings: IndexSettings): Promise<void>;
|
|
13
|
-
updateSettings(index: string, settings: IndexSettings): Promise<void>;
|
|
14
|
-
close(): Promise<void>;
|
|
15
|
-
private _getIndexName;
|
|
16
|
-
private _prepareRecord;
|
|
17
|
-
private _unprepareRecord;
|
|
18
|
-
private _applySettings;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=algolia.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"algolia.d.ts","sourceRoot":"","sources":["../../src/providers/algolia.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACb,MAAM,UAAU,CAAC;AAMlB,qBAAa,eAAgB,YAAW,cAAc;IACpD,QAAQ,CAAC,IAAI,aAAa;IAC1B,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,WAAW,CAAM;gBAEb,MAAM,CAAC,EAAE,aAAa;IAuB5B,aAAa,CAAC,CAAC,SAAS,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB7E,cAAc,CAAC,CAAC,SAAS,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAoCjF,MAAM,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,EACpD,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,WAAW,GACjB,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAyFrB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB9E,cAAc,CAClB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACjD,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