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())