Skip to content

Commit cdcdcf3

Browse files
authored
docs(migration-guide): fix issues (#1417)
Signed-off-by: Alex C-G <alexcg@outlook.com>
1 parent fb79668 commit cdcdcf3

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

docs/migration_guide.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,61 @@
22

33
If you are using DocArray v<0.30.0, you will be familiar with its [dataclass API](https://docarray.jina.ai/fundamentals/dataclass/).
44

5-
_DocArray v2 is that idea, taken seriously._ Every document is created through dataclass-like interface,
5+
_DocArray v2 is that idea, taken seriously._ Every document is created through a dataclass-like interface,
66
courtesy of [Pydantic](https://pydantic-docs.helpmanual.io/usage/models/).
77

88
This gives the following advantages:
99

10-
- **Flexibility:** No need to conform to a fixed set of fields -- your data defines the schema
11-
- **Multi-modality:** Easily store multiple modalities and multiple embeddings in the same Document
12-
- **Language agnostic:** At its core, Documents are just dictionaries. This makes it easy to create and send them from any language, not just Python.
10+
- **Flexibility:** No need to conform to a fixed set of fields -- your data defines the schema.
11+
- **Multi-modality:** Easily store multiple modalities and multiple embeddings in the same document.
12+
- **Language agnostic:** At their core, documents are just dictionaries. This makes it easy to create and send them from any language, not just Python.
1313

1414
You may also be familiar with our old Document Stores for vector DB integration.
1515
They are now called **Document Indexes** and offer the following improvements:
1616

17-
- **Hybrid search:** You can now combine vector search with text search, and even filter by arbitrary fields
18-
- **Production-ready:** The new Document Indexes are a much thinner wrapper around the various vector DB libraries, making them more robust and easier to maintain
19-
- **Increased flexibility:** We strive to support any configuration or setting that you could perform through the DB's first-party client
17+
- **Hybrid search:** You can now combine vector search with text search, and even filter by arbitrary fields.
18+
- **Production-ready:** The new Document Indexes are a much thinner wrapper around the various vector DB libraries, making them more robust and easier to maintain.
19+
- **Increased flexibility:** We strive to support any configuration or setting that you could perform through the DB's first-party client.
2020

2121
For now, Document Indexes support **[Weaviate](https://weaviate.io/)**, **[Qdrant](https://qdrant.tech/)**, **[ElasticSearch](https://www.elastic.co/)**, and **[HNSWLib](https://github.com/nmslib/hnswlib)**, with more to come.
2222

2323
## Changes to `Document`
2424

2525
- `Document` has been renamed to [`BaseDoc`][docarray.BaseDoc].
26-
- `BaseDoc` can not be used directly, but instead has to be extended. Therefore, each document class is created through a dataclass-like interface.
26+
- `BaseDoc` cannot be used directly, but instead has to be extended. Therefore, each document class is created through a dataclass-like interface.
2727
- Following from the previous point, the extending of `BaseDoc` allows for a flexible schema while the
2828
`Document` class in v1 only allowed for a fixed schema, with one of `tensor`, `text` and `blob`,
2929
and additional `chunks` and `matches`.
3030
- Due to the added flexibility, one can not know what fields your document class will provide.
3131
Therefore, various methods from v1 (such as `.load_uri_to_image_tensor()`) are not supported in v2.
32-
Instead, we provide some of those methods on [typing-level](data_types/first_steps.md).
32+
Instead, we provide some of those methods on the [typing-level](data_types/first_steps.md).
3333
- In v2 we have the [`LegacyDocument`][docarray.documents.legacy.LegacyDocument] class,
3434
which extends `BaseDoc` while following the same schema as v1's `Document`.
3535
The `LegacyDocument` can be useful to start migrating your codebase from v1 to v2.
3636
Nevertheless, the API is not fully compatible with DocArray v1 `Document`.
37-
Indeed, none of the method associated with `Document` are present.
37+
Indeed, none of the methods associated with `Document` are present.
3838
Only the schema of the data is similar.
3939

4040
## Changes to `DocumentArray`
4141

4242
### DocList
4343

4444
- The `DocumentArray` class from v1 has been renamed to [`DocList`][docarray.array.DocList],
45-
to be more descriptive of its actual functionality, since it is a list of `BaseDoc`s
45+
to be more descriptive of its actual functionality, since it is a list of `BaseDoc`s.
4646

4747
### DocVec
4848

49-
- Additionally, we introduced the class [`DocVec`][docarray.array.DocVec], which is a column based representation of `BaseDoc`s.
49+
- Additionally, we have introduced the class [`DocVec`][docarray.array.DocVec], which is a column-based representation of `BaseDoc`s.
5050
Both `DocVec` and `DocList` extend `AnyDocArray`.
51-
- `DocVec` is a container of Documents appropriates to perform computation that require batches of data
51+
- `DocVec` is a container of Documents appropriate for performing computation that requires batches of data
5252
(ex: matrix multiplication, distance calculation, deep learning forward pass).
5353
- A `DocVec` has a similar interface as `DocList`
54-
but with an underlying implementation that is column based instead of row based.
54+
but with an underlying implementation that is column-based instead of row-based.
5555
Each field of the schema of the `DocVec` (the `.doc_type` which is a
5656
`BaseDoc`) will be stored in a column.
5757
If the field is a tensor, the data from all Documents will be stored as a single
58-
doc_vec (torch/np/tf) tensor. If the tensor field is `AnyTensor` or a Union of tensor types, the
59-
`.tensor_type` will be used to determine the type of the doc_vec column.
58+
`doc_vec` (torch/np/tf) tensor. If the tensor field is `AnyTensor` or a Union of tensor types, the
59+
`.tensor_type` will be used to determine the type of the `doc_vec` column.
6060

6161
### Parameterized DocList
6262
- With the added flexibility of your document schema, and therefore endless options to design your document schema,
@@ -78,7 +78,7 @@ of the attribute's name on your DocArray instance.
7878
- In v2 you don't have to use the plural, but instead just use the document's attribute name,
7979
since `AnyDocArray` will expose the same attributes as the `BaseDoc`s it contains.
8080
This will return a list of `type(attribute)`.
81-
However, this only works if (and only if) all the `BaseDoc`s in the `AnyDocArray` have the same schema. Therfore this only works
81+
However, this works if (and only if) all the `BaseDoc`s in the `AnyDocArray` have the same schema. Therfore only this works:
8282

8383
```python
8484
from docarray import BaseDoc, DocList
@@ -114,4 +114,4 @@ in v2 you can initialize a `DocIndex` object of your choice, such as:
114114
db = HnswDocumentIndex[MyDoc](work_dir='/my/work/dir')
115115
```
116116

117-
In contrast, [`DocStore`](user_guide/storing/first_step.md#document-store) in v2 can be used for simple long-term storage, such as with AWS S3 buckets or JINA AI Cloud.
117+
In contrast, [`DocStore`](user_guide/storing/first_step.md#document-store) in v2 can be used for simple long-term storage, such as with AWS S3 buckets or Jina AI Cloud.

0 commit comments

Comments
 (0)