From 2468ea7f3136cb74240916c73696efa1b3061137 Mon Sep 17 00:00:00 2001 From: douxu Date: Tue, 14 Jul 2026 17:07:06 +0800 Subject: [PATCH] refactor: simplify model selection and attribute handling - fix ShortAttrInfo.GetAttrValue receiver naming - replace conditional branches with switch statements - log test task parameters during validation --- handler/async_task_create_handler.go | 3 +-- model/redis_recommend.go | 8 ++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/handler/async_task_create_handler.go b/handler/async_task_create_handler.go index 6da67c5..9afa1d9 100644 --- a/handler/async_task_create_handler.go +++ b/handler/async_task_create_handler.go @@ -154,8 +154,7 @@ func validateBatchImportParams(params map[string]any) bool { func validateTestTaskParams(params map[string]any) bool { // Test task has optional parameters, all are valid // sleep_duration defaults to 60 seconds if not provided - // TODO Add more validation logic for test task parameters if needed - fmt.Println(params) + fmt.Println("Test task parameters:", params) return true } diff --git a/model/redis_recommend.go b/model/redis_recommend.go index 6c2aa63..8a5a803 100644 --- a/model/redis_recommend.go +++ b/model/redis_recommend.go @@ -1264,6 +1264,14 @@ func runFuzzySearch(ctx context.Context, rdb *redis.Client, searchInput string, termLastPart = term[lastDotIndex+1:] } + if recommendLenType == constants.FullRecommendLength && hierarchy == constants.GridRecommendHierarchyType { + exists, err := rdb.SIsMember(ctx, constants.RedisAllGridSetKey, termLastPart).Result() + if err != nil || !exists { + logger.Info(ctx, "query key by redis fuzzy search failed or term not in redis all grid set", "query_key", fuzzyInput, "exists", exists, "error", err) + continue + } + } + switch recommendLenType { case constants.FullRecommendLength: if result.Term == "" {