lucivy 0.1.0 → 0.2.1
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 +9 -0
- package/index.d.ts +2 -0
- package/lucivy.node +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,6 +64,12 @@ let results = index.search('rust async programming');
|
|
|
64
64
|
|
|
65
65
|
// Options
|
|
66
66
|
results = index.search('rust', { limit: 20, highlights: true, allowedIds: [1, 3] });
|
|
67
|
+
|
|
68
|
+
// Retrieve stored field values with results
|
|
69
|
+
results = index.search('rust', { fields: true });
|
|
70
|
+
for (const r of results) {
|
|
71
|
+
console.log(r.docId, r.fields.title, r.fields.body);
|
|
72
|
+
}
|
|
67
73
|
```
|
|
68
74
|
|
|
69
75
|
#### contains — substring, fuzzy, regex (cross-token)
|
|
@@ -89,6 +95,9 @@ index.search({ type: 'contains', field: 'body', value: 'program.*language', rege
|
|
|
89
95
|
```javascript
|
|
90
96
|
// "rust safety" → contains("rust") OR contains("safety") on body
|
|
91
97
|
index.search({ type: 'contains_split', field: 'body', value: 'rust safety' });
|
|
98
|
+
|
|
99
|
+
// With fuzzy distance — each word gets fuzzy tolerance
|
|
100
|
+
index.search({ type: 'contains_split', field: 'body', value: 'memry safty', distance: 1 });
|
|
92
101
|
```
|
|
93
102
|
|
|
94
103
|
#### boolean — combine queries with must / should / must_not
|
package/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export interface SearchResult {
|
|
|
7
7
|
docId: number
|
|
8
8
|
score: number
|
|
9
9
|
highlights?: Record<string, Array<Array<number>>>
|
|
10
|
+
fields?: Record<string, string>
|
|
10
11
|
}
|
|
11
12
|
export interface FieldDef {
|
|
12
13
|
name: string
|
|
@@ -19,6 +20,7 @@ export interface SearchOptions {
|
|
|
19
20
|
limit?: number
|
|
20
21
|
highlights?: boolean
|
|
21
22
|
allowedIds?: Array<number>
|
|
23
|
+
fields?: boolean
|
|
22
24
|
}
|
|
23
25
|
export declare class Index {
|
|
24
26
|
/** Create a new index at the given path. */
|
package/lucivy.node
CHANGED
|
Binary file
|