@magicpages/ghost-typesense-cli 1.0.0 → 1.0.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 +91 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# @magicpages/ghost-typesense-cli
|
|
2
|
+
|
|
3
|
+
A command-line interface for managing Ghost content in Typesense. This tool provides commands for initializing collections, syncing content, and maintaining your search index.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @magicpages/ghost-typesense-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
The CLI provides three main commands:
|
|
14
|
+
|
|
15
|
+
### Initialize Collection
|
|
16
|
+
|
|
17
|
+
Creates or recreates the Typesense collection with the specified schema:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
ghost-typesense init --config ./ghost-typesense.config.json
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Sync Content
|
|
24
|
+
|
|
25
|
+
Performs a full sync of all Ghost content to Typesense:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
ghost-typesense sync --config ./ghost-typesense.config.json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Clear Collection
|
|
32
|
+
|
|
33
|
+
Removes all documents from the Typesense collection:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
ghost-typesense clear --config ./ghost-typesense.config.json
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Configuration
|
|
40
|
+
|
|
41
|
+
Create a `ghost-typesense.config.json` file in your project:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"ghost": {
|
|
46
|
+
"url": "https://your-ghost-blog.com",
|
|
47
|
+
"key": "your-content-api-key",
|
|
48
|
+
"version": "v5.0"
|
|
49
|
+
},
|
|
50
|
+
"typesense": {
|
|
51
|
+
"nodes": [{
|
|
52
|
+
"host": "your-typesense-host",
|
|
53
|
+
"port": 443,
|
|
54
|
+
"protocol": "https"
|
|
55
|
+
}],
|
|
56
|
+
"apiKey": "your-typesense-api-key",
|
|
57
|
+
"connectionTimeoutSeconds": 10,
|
|
58
|
+
"retryIntervalSeconds": 0.1
|
|
59
|
+
},
|
|
60
|
+
"collection": {
|
|
61
|
+
"name": "posts",
|
|
62
|
+
"fields": [
|
|
63
|
+
{ "name": "id", "type": "string" },
|
|
64
|
+
{ "name": "title", "type": "string", "index": true, "sort": true },
|
|
65
|
+
{ "name": "slug", "type": "string", "index": true },
|
|
66
|
+
{ "name": "html", "type": "string", "index": true },
|
|
67
|
+
{ "name": "excerpt", "type": "string", "index": true },
|
|
68
|
+
{ "name": "feature_image", "type": "string", "index": false, "optional": true },
|
|
69
|
+
{ "name": "published_at", "type": "int64", "sort": true },
|
|
70
|
+
{ "name": "updated_at", "type": "int64", "sort": true },
|
|
71
|
+
{ "name": "tags", "type": "string[]", "facet": true, "optional": true },
|
|
72
|
+
{ "name": "authors", "type": "string[]", "facet": true, "optional": true }
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Field Configuration
|
|
79
|
+
|
|
80
|
+
The `fields` array in your configuration defines the schema for your Typesense collection. Each field object supports:
|
|
81
|
+
|
|
82
|
+
- `name` (required): Field name
|
|
83
|
+
- `type` (required): Data type (`string`, `int32`, `int64`, `float`, `bool`, `string[]`, etc.)
|
|
84
|
+
- `index` (optional): Whether the field is searchable
|
|
85
|
+
- `sort` (optional): Whether the field can be used for sorting
|
|
86
|
+
- `facet` (optional): Whether the field can be used for faceted search
|
|
87
|
+
- `optional` (optional): Whether the field is required
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
MIT - see the [LICENSE](../../LICENSE) file for details.
|