Skip to content

Commit 499c7d1

Browse files
authored
docs(reexport): update documents to explain reexport options (#975)
1 parent 32171fd commit 499c7d1

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

docs/docs/core/flow_methods.mdx

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ If you want to remove the flow from the current process, you can call `demo_flow
108108

109109
:::
110110

111-
## Build / update target data
111+
## Build/update target data
112112

113-
The major goal of a flow is to perform the transformations on source data and build / update data in the target.
113+
The major goal of a flow is to perform the transformations on source data and build/update data in the target.
114114
This action has two modes:
115115

116116
* **One time update.**
@@ -119,7 +119,7 @@ This action has two modes:
119119
It fits into situations that you need to access the fresh target data at certain time points.
120120

121121
* **Live update.**
122-
It continuously captures changes from the source data and updates the target data accordingly.
122+
During live update, a one time update is performed first, then it continuously captures changes from the source data and updates the target data accordingly.
123123
It's long-running and only stops when being aborted explicitly.
124124
It fits into situations that you need to access the fresh target data continuously in most of the time.
125125

@@ -131,6 +131,12 @@ This is to achieve best efficiency.
131131

132132
:::
133133

134+
Besides major update modes, CocoIndex also support the following options:
135+
136+
* **Reexport targets**.
137+
When this is enabled, even if both of the source data and flow definition are not changed, CocoIndex will still reprocess and reexport the targets.
138+
It's helpful when you want to reload the target data, e.g. after some data loss.
139+
Note that when this is enabled on live update mode, reexport only happens for the initial one time update.
134140

135141
### One time update
136142

@@ -150,6 +156,12 @@ With a `--setup` option, it will also setup the flow first if needed.
150156
cocoindex update --setup main.py
151157
```
152158

159+
With a `--reexport` option, it will reexport the targets even if there's no change.
160+
161+
```sh
162+
cocoindex update --reexport main.py
163+
```
164+
153165
#### Library API
154166

155167
<Tabs>
@@ -179,6 +191,14 @@ It's quite cheap to do so, as CocoIndex will automatically combine multiple call
179191

180192
:::
181193

194+
Both `update()` and `update_async()` can take a `reexport_targets` option to enable reexporting the targets even if there's no change.
195+
196+
```python
197+
demo_flow.update(reexport_targets=True)
198+
...
199+
await demo_flow.update_async(reexport_targets=True)
200+
...
201+
```
182202

183203
</TabItem>
184204
</Tabs>
@@ -206,11 +226,7 @@ cocoindex update main.py -L
206226
If there's at least one data source with change capture mechanism enabled, it will keep running until aborted (e.g. by `Ctrl-C`).
207227
Otherwise, it falls back to the same behavior as one time update, and will finish after a one-time update is done.
208228

209-
With a `--setup` option, it will also setup the flow first if needed.
210-
211-
```sh
212-
cocoindex update main.py -L --setup
213-
```
229+
`--setup` and `--reexport` options are also available for live update mode.
214230

215231
#### Library API
216232

@@ -226,6 +242,8 @@ It takes an optional `cocoindex.FlowLiveUpdaterOptions` option, with the followi
226242

227243
* `print_stats` (type: `bool`, default: `False`): Whether to print stats during update.
228244

245+
* `reexport_targets` (type: `bool`, default: `False`): Whether to reexport the targets even if there's no change.
246+
229247
Note that `cocoindex.FlowLiveUpdater` provides a unified interface for both one-time update and live update.
230248
It only performs live update when `live_mode` is `True`, and only for sources with change capture mechanisms enabled.
231249
If a source has multiple change capture mechanisms enabled, all will take effect to trigger updates.

0 commit comments

Comments
 (0)