mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-14 13:52:11 +00:00
search work in progress
This commit is contained in:
1 parent
24f5660d2f
commit
8e1f49a588
4 files changed
+103
-4
No files matched your search
@@ -1 +0,0 @@
|
||||
{}
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"query": {
|
||||
"bool": {
|
||||
"must": [
|
||||
{
|
||||
"bool": {
|
||||
"must" : [
|
||||
{
|
||||
"term": {
|
||||
"media_class": "dimensional"
|
||||
}
|
||||
},
|
||||
{
|
||||
"term": {
|
||||
"media_type": "glb"
|
||||
}
|
||||
}
|
||||
],
|
||||
"should": [
|
||||
{
|
||||
"fuzzy": {
|
||||
"maybe_title": {
|
||||
"value": "cac",
|
||||
"fuzziness": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": {
|
||||
"maybe_title": {
|
||||
"query": "cac",
|
||||
"boost": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"multi_match": {
|
||||
"query": "cac",
|
||||
"type": "bool_prefix",
|
||||
"fields": [
|
||||
"maybe_title",
|
||||
"maybe_title._2gram",
|
||||
"maybe_title._3gram"
|
||||
],
|
||||
"boost": 50
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"query": {
|
||||
"bool": {
|
||||
"must": [
|
||||
{
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"fuzzy": {
|
||||
"title": {
|
||||
"value": "REPLACE_ME",
|
||||
"fuzziness": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": {
|
||||
"title": {
|
||||
"query": "REPLACE_ME",
|
||||
"boost": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"multi_match": {
|
||||
"query": "REPLACE_ME",
|
||||
"type": "bool_prefix",
|
||||
"fields": [
|
||||
"title",
|
||||
"title._2gram",
|
||||
"title._3gram"
|
||||
],
|
||||
"boost": 50
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-3
@@ -34,6 +34,8 @@ pub async fn create_dimensional_media_file_documents(
|
||||
let mut cursor = 0;
|
||||
|
||||
loop {
|
||||
info!("Cursor: {cursor}");
|
||||
|
||||
let results = list_media_files_for_elastic_search_backfill_using_cursor(ListArgs {
|
||||
mysql_pool: mysql,
|
||||
page_size: PAGE_SIZE,
|
||||
@@ -63,6 +65,8 @@ pub async fn create_dimensional_media_file_documents(
|
||||
])),
|
||||
}).await?;
|
||||
|
||||
info!("Results length: {}", results.len());
|
||||
|
||||
if results.is_empty() {
|
||||
info!("No more results at cursor {cursor}");
|
||||
break;
|
||||
@@ -78,9 +82,9 @@ pub async fn create_dimensional_media_file_documents(
|
||||
}
|
||||
}
|
||||
|
||||
//for result in results {
|
||||
// create_document_from_record(elasticsearch, result).await?;
|
||||
//}
|
||||
for result in results {
|
||||
create_document_from_record(elasticsearch, result).await?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in new issue
Block a user