Skip to content

Commit c15f9b3

Browse files
committed
📝(backend) add docs
i am documenting the index command Signed-off-by: charles <charles.englebert@protonmail.com>
1 parent 1bffae3 commit c15f9b3

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

docs/commands/index.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Index Command
2+
3+
The `index` management command is used to index documents to the remote search indexer.
4+
5+
It sends an asynchronous task to the Celery worker.
6+
7+
## Usage
8+
9+
### Command line
10+
11+
```bash
12+
python manage.py index \
13+
--lower-time-bound "2024-01-01T00:00:00" \
14+
--upper-time-bound "2024-01-31T23:59:59" \
15+
--batch-size 200 \
16+
--crash-safe-mode
17+
```
18+
19+
### Django Admin
20+
21+
The command is available in the Django admin interface:
22+
23+
1. Go to `/admin/`
24+
2. Click on **"Run Indexing"** in the CORE section
25+
3. Fill in the form with the desired parameters
26+
4. Click **"Run Indexing Command"**
27+
28+
### Make Command
29+
30+
```bash
31+
# Basic usage with defaults
32+
make index
33+
34+
# With custom parameters
35+
make index batch_size=200 lower_time_bound="2024-01-01T00:00:00" crash_safe_mode=true
36+
37+
# All parameters
38+
make index batch_size=200 \
39+
lower_time_bound="2024-01-01T00:00:00" \
40+
upper_time_bound="2024-01-31T23:59:59" \
41+
crash_safe_mode=true
42+
```
43+
44+
## Parameters
45+
46+
### `--batch-size`
47+
- **type:** Integer
48+
- **default:** `50`
49+
- **description:** Number of documents to process per batch. Higher values may improve performance but use more memory.
50+
51+
### `--lower-time-bound`
52+
- **optional**: true
53+
- **type:** ISO 8601 datetime string
54+
- **default:** `None`
55+
- **description:** Only documents updated after this date will be indexed.
56+
57+
### `--upper-time-bound`
58+
- **optional**: true
59+
- **type:** ISO 8601 datetime string
60+
- **default:** `None`
61+
- **description:** Only documents updated before this date will be indexed.
62+
63+
### `--crash-safe-mode`
64+
- **type:** Boolean flag
65+
- **default:** `False`
66+
- **description:** When enabled, the command orders documents by `updated_at` and stores the last indexed document's timestamp in cache. This allows resuming indexing from the last successful batch in case of a crash. However, it is more computationally expensive due to sorting.
67+
68+

0 commit comments

Comments
 (0)