@vibeorm/extensions 2.0.0-alpha.8 → 2.0.0-alpha.9
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 +39 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -99,6 +99,45 @@ The query is split into unicode letter/number tokens (punctuation separates and
|
|
|
99
99
|
- `engine: "bm25"` refuses `prefix` (`VIBE_UNSUPPORTED_CAPABILITY`) — ParadeDB prefix behavior is decided by the index tokenizer, which this extension does not configure.
|
|
100
100
|
- mysql InnoDB ignores tokens shorter than `innodb_ft_min_token_size` (default 3), so one- and two-letter prefixes match nothing there.
|
|
101
101
|
|
|
102
|
+
### Filtering hits: `where` composes with the core filter language
|
|
103
|
+
|
|
104
|
+
`search({ where })` compiles through the same filter compiler as every core query — scalar
|
|
105
|
+
filters, relation filters and `dbNow()` comparisons all AND into the match. The menu
|
|
106
|
+
composition (type-ahead over items that are orderable *right now*):
|
|
107
|
+
|
|
108
|
+
```prisma
|
|
109
|
+
model MenuItem {
|
|
110
|
+
id Int @id @default(autoincrement())
|
|
111
|
+
name String
|
|
112
|
+
description String
|
|
113
|
+
availableFrom DateTime?
|
|
114
|
+
availableTo DateTime?
|
|
115
|
+
category Category? @relation(fields: [categoryId], references: [id])
|
|
116
|
+
categoryId Int?
|
|
117
|
+
|
|
118
|
+
@@search([name, description], weights: [2, 1], language: "simple")
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
import { dbNow } from "@vibeorm/runtime";
|
|
124
|
+
|
|
125
|
+
const hits = await db.menuItem.search({
|
|
126
|
+
query: "piz", // mid-keystroke
|
|
127
|
+
prefix: true,
|
|
128
|
+
take: 8,
|
|
129
|
+
where: {
|
|
130
|
+
category: { is: { active: true } },
|
|
131
|
+
availableFrom: { lte: dbNow() }, // the DATABASE's clock, not the process's
|
|
132
|
+
availableTo: { gte: dbNow() },
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
For typo tolerance ("piza") declare `@@trgm([name])` too and fall back to
|
|
138
|
+
`findMany({ where: { name: { similarTo: query } } })` when a prefix search returns nothing
|
|
139
|
+
(postgres/pglite only).
|
|
140
|
+
|
|
102
141
|
### Hydrating hits with relations
|
|
103
142
|
|
|
104
143
|
`search()` returns bare rows — it has no `include`/`select` of relations. The intended pattern is the `select: "id"` projection plus a re-read through your own typed query, which carries relations, `omit`, computed fields and everything else the core API does:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibeorm/extensions",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.9",
|
|
4
4
|
"description": "Tier-1 VibeORM extensions — full-text search, pgvector similarity and pg_trgm fuzzy matching",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"orm",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"bun": ">=1.2.0"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@vibeorm/runtime": "2.0.0-alpha.
|
|
58
|
-
"@vibeorm/schema": "2.0.0-alpha.
|
|
59
|
-
"@vibeorm/sql": "2.0.0-alpha.
|
|
57
|
+
"@vibeorm/runtime": "2.0.0-alpha.8",
|
|
58
|
+
"@vibeorm/schema": "2.0.0-alpha.6",
|
|
59
|
+
"@vibeorm/sql": "2.0.0-alpha.6"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|