diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx index 1b0cff7..1a70803 100644 --- a/docs/quickstart.mdx +++ b/docs/quickstart.mdx @@ -145,7 +145,8 @@ The vector column holds 3-dimensional embeddings representing each character. To ingest the data into LanceDB, obtain data of the required shape and pass in the data object to the `create_table` method as shown below. Note that LanceDB tables require a schema. If you don't provide one, LanceDB -will infer it from the data. +will infer it from the data. For the Rust snippet, you can find the helper functions in the +[code](https://github.com/lancedb/docs/blob/main/tests/rs/quickstart.rs). @@ -210,11 +211,10 @@ to be used downstream in your application. - See the full code for these examples (including helper functions) in the `quickstart` file for the appropriate client language in the -[docs repo](https://github.com/lancedb/docs/tree/main/tests). +[files provided here](https://github.com/lancedb/docs/tree/main/tests). diff --git a/docs/snippets/quickstart.mdx b/docs/snippets/quickstart.mdx index d26ea2d..aeebdb2 100644 --- a/docs/snippets/quickstart.mdx +++ b/docs/snippets/quickstart.mdx @@ -40,7 +40,7 @@ export const RsQuickstartCreateTable = "// Define an arrow schema named adventur export const RsQuickstartCreateTableNoOverwrite = "table = db\n .create_table(\"adventurers\", adventurers_to_reader(schema.clone(), &data))\n .execute()\n .await\n .unwrap();\n"; -export const RsQuickstartDefineStruct = "// Define a struct representing the data schema\n#[derive(Debug, Clone, Serialize, Deserialize)]\nstruct Adventurer {\n id: String,\n text: String,\n vector: [f32; 3],\n}\n"; +export const RsQuickstartDefineStruct = "// Define a struct representing the data schema\n#[derive(Debug, Clone, Serialize, Deserialize)]\nstruct Adventurer {\n id: String,\n text: String,\n vector: [f32; 3],\n}\n\nfn adventurers_schema() -> Arc {\n Arc::new(Schema::new(vec![\n Field::new(\"id\", DataType::LargeUtf8, false),\n Field::new(\"text\", DataType::LargeUtf8, false),\n Field::new(\n \"vector\",\n DataType::FixedSizeList(Arc::new(Field::new(\"item\", DataType::Float32, true)), 3),\n false,\n ),\n ]))\n}\n"; export const RsQuickstartOpenTable = "let table: Table = db.open_table(\"adventurers\").execute().await.unwrap();\n"; diff --git a/docs/tables/index.mdx b/docs/tables/index.mdx index 241fbd6..a9c7791 100644 --- a/docs/tables/index.mdx +++ b/docs/tables/index.mdx @@ -353,7 +353,8 @@ existing table named `camelot`. Prepare the new records to add. Here, we add two new magical characters -via the `add` method. +via the `add` method. For the Rust snippet, you can find the helper functions in the +[code](https://github.com/lancedb/docs/blob/main/tests/rs/basic_usage.rs). diff --git a/tests/rs/quickstart.rs b/tests/rs/quickstart.rs index 3bbdf5a..df951c3 100644 --- a/tests/rs/quickstart.rs +++ b/tests/rs/quickstart.rs @@ -21,7 +21,6 @@ struct Adventurer { text: String, vector: [f32; 3], } -// --8<-- [end:quickstart_define_struct] fn adventurers_schema() -> Arc { Arc::new(Schema::new(vec![ @@ -34,6 +33,7 @@ fn adventurers_schema() -> Arc { ), ])) } +// --8<-- [end:quickstart_define_struct] type BatchIter = RecordBatchIterator< std::vec::IntoIter>,