@@ -288,12 +288,12 @@ To define what can be stored in them, and what the default values are, you need
288
288
``` python
289
289
@dataclass
290
290
class DBConfig (BaseDocIndex .DBConfig ):
291
- ...
291
+ default_column_config: Dict[Type, Dict[ str , Any]] = ...
292
292
293
293
294
294
@dataclass
295
295
class RuntimeConfig (BaseDocIndex .RuntimeConfig ):
296
- default_column_config: Dict[Type, Dict[ str , Any]] = ...
296
+ ...
297
297
```
298
298
299
299
!!! note
@@ -306,16 +306,8 @@ The `DBConfig` class defines the static configurations of your Document Index.
306
306
These are configurations that are tied to the database (or library) running in the background, such as ` host ` , ` port ` , etc.
307
307
Here you should put everything that the user cannot or should not change after initialization.
308
308
309
- ### The ` RuntimeConfig ` class
310
-
311
- The ` RuntimeConfig ` class defines the dynamic configurations of your Document Index.
312
- These are configurations that can be changed at runtime, for example default behaviours such as batch sizes, consistency levels, etc.
313
-
314
- It is a common pattern to allow such parameters both in the ` RuntimeConfig ` , where they will act as global defaults, and
315
- in specific methods (` index ` , ` find ` , etc.), where they will act as local overrides.
316
-
317
309
!!! note
318
- Every ` RuntimeConfig ` needs to contain a ` default_column_config ` field.
310
+ Every ` DBConfig ` needs to contain a ` default_column_config ` field.
319
311
This is a dictionary that, for each possible column type in your database, defines a default configuration for that column type.
320
312
This will automatically be passed to a ` _ColumnInfo ` whenever a user does not manually specify a configuration for that column.
321
313
@@ -327,6 +319,15 @@ and for `varchar` columns you could define a `max_length` configuration.
327
319
328
320
It is probably best to see this in action, so you should check out the ` HnswDocumentIndex ` implementation.
329
321
322
+ ### The ` RuntimeConfig ` class
323
+
324
+ The ` RuntimeConfig ` class defines the dynamic configurations of your Document Index.
325
+ These are configurations that can be changed at runtime, for example default behaviours such as batch sizes, consistency levels, etc.
326
+
327
+ It is a common pattern to allow such parameters both in the ` RuntimeConfig ` , where they will act as global defaults, and
328
+ in specific methods (` index ` , ` find ` , etc.), where they will act as local overrides.
329
+
330
+
330
331
## Implement abstract methods for indexing, searching, and deleting
331
332
332
333
After you've done the basic setup above, you can jump into the good stuff: implementing the actual indexing, searching, and deleting.
@@ -374,7 +375,7 @@ class MySchema(BaseDoc):
374
375
375
376
In this case, the ` db_type ` of ` my_num ` will be ` 'float64' ` and the ` db_type ` of ` my_text ` will be ` 'varchar' ` .
376
377
Additional information regarding the ` col_type ` , such as ` max_len ` for ` varchar ` will be stored in the ` _ColumnsInfo.config ` .
377
- The given ` col_type ` has to be a valid ` db_type ` , meaning that has to be described in the index's ` RuntimeConfig .default_column_config` .
378
+ The given ` col_type ` has to be a valid ` db_type ` , meaning that has to be described in the index's ` DBConfig .default_column_config` .
378
379
379
380
### The ` _index() ` method
380
381
0 commit comments