update pay function
This commit is contained in:
@@ -110,7 +110,7 @@ class SearchRequest(BaseModel):
|
|||||||
semantic_weight: Optional[float] = Field(None, ge=0.0, le=1.0, description="语义搜索权重(0-1),None表示自动计算")
|
semantic_weight: Optional[float] = Field(None, ge=0.0, le=1.0, description="语义搜索权重(0-1),None表示自动计算")
|
||||||
filter_stocks: Optional[List[str]] = Field(None, description="过滤特定股票代码或名称")
|
filter_stocks: Optional[List[str]] = Field(None, description="过滤特定股票代码或名称")
|
||||||
trade_date: Optional[date] = Field(None, description="交易日期,格式:YYYY-MM-DD,默认返回最新日期数据")
|
trade_date: Optional[date] = Field(None, description="交易日期,格式:YYYY-MM-DD,默认返回最新日期数据")
|
||||||
sort_by: str = Field("change_pct", description="排序方式: change_pct, _score, stock_count, concept_name")
|
sort_by: str = Field("change_pct", description="排序方式: change_pct, _score, stock_count, concept_name, added_date")
|
||||||
use_knn: bool = Field(True, description="是否使用KNN搜索优化语义搜索")
|
use_knn: bool = Field(True, description="是否使用KNN搜索优化语义搜索")
|
||||||
|
|
||||||
|
|
||||||
@@ -721,6 +721,14 @@ async def search_concepts(request: SearchRequest):
|
|||||||
all_results.sort(key=lambda x: x.stock_count, reverse=True)
|
all_results.sort(key=lambda x: x.stock_count, reverse=True)
|
||||||
elif request.sort_by == "concept_name":
|
elif request.sort_by == "concept_name":
|
||||||
all_results.sort(key=lambda x: x.concept)
|
all_results.sort(key=lambda x: x.concept)
|
||||||
|
elif request.sort_by == "added_date":
|
||||||
|
# 按添加日期排序(降序 - 最新的在前)
|
||||||
|
all_results.sort(
|
||||||
|
key=lambda x: (
|
||||||
|
x.happened_times[0] if x.happened_times and len(x.happened_times) > 0 else '1900-01-01'
|
||||||
|
),
|
||||||
|
reverse=True
|
||||||
|
)
|
||||||
# _score排序已经由ES处理
|
# _score排序已经由ES处理
|
||||||
|
|
||||||
# 计算分页
|
# 计算分页
|
||||||
|
|||||||
Reference in New Issue
Block a user