From dfbfdf586b1797bd58643ad6033644d076b0b92f Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 31 Mar 2022 10:58:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/dbsql/dataset_foreigntable_for_es.sql | 7 ++----- routers/search.go | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/models/dbsql/dataset_foreigntable_for_es.sql b/models/dbsql/dataset_foreigntable_for_es.sql index 0bb96c38d..0dd6e4968 100644 --- a/models/dbsql/dataset_foreigntable_for_es.sql +++ b/models/dbsql/dataset_foreigntable_for_es.sql @@ -121,12 +121,9 @@ CREATE OR REPLACE FUNCTION public.udpate_dataset_file_name() RETURNS trigger AS $def$ BEGIN if (TG_OP = 'UPDATE') then - update public.dataset_es SET file_name=(select array_to_string(array_agg(name order by created_unix desc),'-#,#-') from public.attachment where dataset_id=NEW.dataset_id and is_private=false) where id=NEW.dataset_id; + update public.dataset_es SET file_name=(select array_to_string(array_agg(name order by created_unix desc),'-#,#-') from public.attachment where dataset_id=NEW.dataset_id and is_private=false) where id=NEW.dataset_id; update public.dataset_es SET file_desc=(select array_to_string(array_agg(description order by created_unix desc),'-#,#-') from public.attachment where dataset_id=NEW.dataset_id and is_private=false) where id=NEW.dataset_id; - elsif (TG_OP = 'INSERT') then - update public.dataset_es SET file_name=(select array_to_string(array_agg(name order by created_unix desc),'-#,#-') from public.attachment where dataset_id=NEW.dataset_id and is_private=false) where id=NEW.dataset_id; - update public.dataset_es SET file_desc=(select array_to_string(array_agg(description order by created_unix desc),'-#,#-') from public.attachment where dataset_id=NEW.dataset_id and is_private=false) where id=NEW.dataset_id; - elsif (TG_OP = 'DELETE') then + elsif (TG_OP = 'DELETE') then update public.dataset_es SET file_name=(select array_to_string(array_agg(name order by created_unix desc),'-#,#-') from public.attachment where dataset_id=OLD.dataset_id and is_private=false) where id=OLD.dataset_id; update public.dataset_es SET file_desc=(select array_to_string(array_agg(description order by created_unix desc),'-#,#-') from public.attachment where dataset_id=OLD.dataset_id and is_private=false) where id=OLD.dataset_id; end if; diff --git a/routers/search.go b/routers/search.go index 0b83d81ee..bc1bc5fac 100644 --- a/routers/search.go +++ b/routers/search.go @@ -949,7 +949,7 @@ func makeDatasetResult(sRes *elastic.SearchResult, Key string, OnlyReturnNum boo record["task"] = recordSource["task"] record["download_times"] = recordSource["download_times"] record["created_unix"] = recordSource["created_unix"] - setUpdateHtml(record, recordSource["created_unix"].(string), language) + setUpdateHtml(record, recordSource["updated_unix"].(string), language) result = append(result, record) } else { log.Info("deal dataset source error," + err.Error())