Skip to content

Commit b0e4a4d

Browse files
committed
chore: review updates
Signed-off-by: Anush008 <[email protected]>
1 parent 8733bc1 commit b0e4a4d

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

docs/docs/ops/storages.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ description: CocoIndex Built-in Storages
1111

1212
The spec takes the following fields:
1313

14-
* `database_url` (type: `str`, optional): The URL of the Postgres database to use as the internal storage, e.g. `postgres://cocoindex:cocoindex@localhost/cocoindex`. If unspecified, will use the same database as the [internal storage](/docs/core/basics#internal-storage).
14+
* `database_url` (type: `str`, optional): The URL of the Postgres database to use as the internal storage, e.g. `postgres://cocoindex:cocoindex@localhost/cocoindex`. If unspecified, will use the same database as the [internal storage](/docs/core/basics#internal-storage).
1515

16-
* `table_name` (type: `str`, optional): The name of the table to store to. If unspecified, will generate a new automatically. We recommend specifying a name explicitly if you want to directly query the table. It can be omitted if you want to use CocoIndex's query handlers to query the table.
16+
* `table_name` (type: `str`, optional): The name of the table to store to. If unspecified, will generate a new automatically. We recommend specifying a name explicitly if you want to directly query the table. It can be omitted if you want to use CocoIndex's query handlers to query the table.
1717

1818
## Qdrant
1919

2020
`Qdrant` exports data to a [Qdrant](https://qdrant.tech/) collection.
2121

2222
The spec takes the following fields:
2323

24-
* `qdrant_url` (type: `str`, required): The [gRPC URL](https://qdrant.tech/documentation/interfaces/#grpc-interface) of the Qdrant instance. Defaults to <http://localhost:6334/>.
24+
* `qdrant_url` (type: `str`, required): The [gRPC URL](https://qdrant.tech/documentation/interfaces/#grpc-interface) of the Qdrant instance. Defaults to http://localhost:6334/.
2525

26-
* `collection` (type: `str`, required): The name of the collection to export the data to.
26+
* `collection` (type: `str`, required): The name of the collection to export the data to.

src/ops/storages/qdrant.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,10 @@ impl ExportTargetExecutor for Executor {
7070
async fn apply_mutation(&self, mutation: ExportTargetMutation) -> Result<()> {
7171
let mut points: Vec<PointStruct> = Vec::with_capacity(mutation.upserts.len());
7272
for upsert in mutation.upserts.iter() {
73-
let key_fields = key_value_fields_iter(&self.key_fields_schema, &upsert.key)?
74-
.iter()
75-
.collect();
76-
let key_fields = parse_key_fields(&key_fields, &self.key_fields_schema)?;
73+
let key_fields = key_value_fields_iter(&self.key_fields_schema, &upsert.key)?;
74+
let key_fields = key_values_to_payload(&key_fields, &self.key_fields_schema)?;
7775
let (mut payload, vectors) =
78-
parse_value_fields(&upsert.value.fields, &self.value_fields_schema)?;
76+
values_to_payload(&upsert.value.fields, &self.value_fields_schema)?;
7977
payload.extend(key_fields);
8078

8179
points.push(PointStruct::new(1, vectors, payload));
@@ -88,8 +86,8 @@ impl ExportTargetExecutor for Executor {
8886
}
8987
}
9088

91-
fn parse_key_fields(
92-
key_fields: &Vec<&KeyValue>,
89+
fn key_values_to_payload(
90+
key_fields: &[KeyValue],
9391
schema: &Vec<FieldSchema>,
9492
) -> Result<HashMap<String, QdrantValue>> {
9593
let mut payload = HashMap::with_capacity(key_fields.len());
@@ -117,7 +115,7 @@ fn parse_key_fields(
117115
Ok(payload)
118116
}
119117

120-
fn parse_value_fields(
118+
fn values_to_payload(
121119
value_fields: &Vec<Value>,
122120
schema: &Vec<FieldSchema>,
123121
) -> Result<(HashMap<String, QdrantValue>, NamedVectors)> {

0 commit comments

Comments
 (0)