(db_path: &Path)
| 13 | }; |
| 14 | |
| 15 | pub async fn run(db_path: &Path) -> Result<()> { |
| 16 | let db = connect_db(db_path).await?; |
| 17 | |
| 18 | let articles_table = ensure_table(&db, "articles", article_schema()).await?; |
| 19 | let images_table = ensure_table(&db, "images", image_schema()).await?; |
| 20 | ensure_table(&db, "taxonomies", taxonomy_schema()).await?; |
| 21 | let _interactive_store = InteractivePageStore::connect(&db_path.to_string_lossy()).await?; |
| 22 | |
| 23 | if let Err(err) = ensure_fts_index(&articles_table, "content").await { |
| 24 | tracing::warn!("Failed to create FTS index on articles: {err}"); |
| 25 | } |
| 26 | |
| 27 | if let Err(err) = ensure_vector_index(&articles_table, "vector_en").await { |
| 28 | tracing::warn!("Failed to create vector index on articles (vector_en): {err}"); |
| 29 | } |
| 30 | if let Err(err) = ensure_vector_index(&articles_table, "vector_zh").await { |
| 31 | tracing::warn!("Failed to create vector index on articles (vector_zh): {err}"); |
| 32 | } |
| 33 | if let Err(err) = ensure_vector_index(&images_table, "vector").await { |
| 34 | tracing::warn!("Failed to create vector index on images: {err}"); |
| 35 | } |
| 36 | |
| 37 | let _ = articles_table |
| 38 | .query() |
| 39 | .full_text_search(FullTextSearchQuery::new("init".to_string())) |
| 40 | .limit(1) |
| 41 | .execute() |
| 42 | .await; |
| 43 | |
| 44 | tracing::info!("LanceDB initialized at {}", db_path.display()); |
| 45 | Ok(()) |
| 46 | } |
nothing calls this directly
no test coverage detected