mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-11 04:16:55 +00:00
ES SQL dialect doesn't support all data types
This commit is contained in:
1 parent
d634fd9e6b
commit
409eadbfe5
3 files changed
+12
-2
No files matched your search
@@ -13,6 +13,7 @@
|
||||
"weights_category" : { "type" : "keyword" },
|
||||
|
||||
"title" : { "type" : "search_as_you_type" },
|
||||
"title_as_keyword" : { "type" : "keyword" },
|
||||
|
||||
"maybe_cover_image_media_file_token" : { "type" : "keyword" },
|
||||
"maybe_cover_image_public_bucket_hash" : { "type" : "keyword" },
|
||||
|
||||
+7
-2
@@ -13,7 +13,11 @@ use errors::AnyhowResult;
|
||||
use mysql_queries::queries::model_weights::list::list_model_weights_for_elastic_search_backfill_using_cursor::{list_model_weights_for_elastic_search_backfill_using_cursor, ModelWeightForElasticsearchRecord};
|
||||
use storyteller_root::get_storyteller_rust_root;
|
||||
|
||||
pub async fn create_all_model_weight_documents(mysql: &Pool<MySql>, elasticsearch: &Elasticsearch) -> AnyhowResult<()> {
|
||||
pub async fn create_all_model_weight_documents(
|
||||
mysql: &Pool<MySql>,
|
||||
elasticsearch: &Elasticsearch
|
||||
) -> AnyhowResult<()> {
|
||||
|
||||
info!("Create all model weight documents.");
|
||||
|
||||
// TODO(bt, 2024-01-10): expose this as a CLI flag
|
||||
@@ -63,7 +67,8 @@ async fn create_document_from_record(elasticsearch: &Elasticsearch, record: Mode
|
||||
weights_type: record.weights_type,
|
||||
weights_category: record.weights_category,
|
||||
|
||||
title: record.title,
|
||||
title: record.title.clone(),
|
||||
title_as_keyword: record.title,
|
||||
|
||||
maybe_cover_image_media_file_token: record.maybe_cover_image_media_file_token,
|
||||
maybe_cover_image_public_bucket_hash: record.maybe_cover_image_public_bucket_hash,
|
||||
|
||||
@@ -30,6 +30,10 @@ pub struct ModelWeightDocument {
|
||||
|
||||
pub title: String,
|
||||
|
||||
// NB: Not all datatypes are supported in the SQL DSL, so we have a copy of the title:
|
||||
// https://opensearch.org/docs/latest/search-plugins/sql/datatypes/
|
||||
pub title_as_keyword: String,
|
||||
|
||||
// *** NB: Never put the bucket path to the model in Elasticsearch ! ***
|
||||
|
||||
pub maybe_cover_image_media_file_token: Option<MediaFileToken>,
|
||||
|
||||
Reference in new issue
Block a user