Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d4de99971a |
@@ -199,7 +199,8 @@ def get_registration_code(code: str):
|
||||
|
||||
def list_registration_codes():
|
||||
try:
|
||||
search = RegistrationCodeDocument.search()
|
||||
# 增加 size=1000 以支持返回更多注册码
|
||||
search = RegistrationCodeDocument.search()[:1000]
|
||||
body = {
|
||||
"sort": [{"created_at": {"order": "desc"}}],
|
||||
"query": {"exists": {"field": "code"}}
|
||||
@@ -297,7 +298,8 @@ def search_data(query):
|
||||
"""
|
||||
try:
|
||||
# 使用Django-elasticsearch-dsl进行搜索
|
||||
search = AchievementDocument.search()
|
||||
# 增加 size=10000 以支持返回更多结果(ES默认限制为10000,如需更多需分页)
|
||||
search = AchievementDocument.search()[:10000]
|
||||
search = search.query("multi_match", query=query, fields=['*'])
|
||||
response = search.execute()
|
||||
|
||||
@@ -319,7 +321,8 @@ def search_data(query):
|
||||
def search_all():
|
||||
"""获取所有文档"""
|
||||
try:
|
||||
search = AchievementDocument.search()
|
||||
# 增加 size=10000 以支持返回更多结果(ES默认限制为10000,如需更多需分页)
|
||||
search = AchievementDocument.search()[:10000]
|
||||
search = search.query("match_all")
|
||||
response = search.execute()
|
||||
|
||||
@@ -421,7 +424,8 @@ def search_by_any_field(keyword):
|
||||
list: 包含搜索结果的列表
|
||||
"""
|
||||
try:
|
||||
search = AchievementDocument.search()
|
||||
# 增加 size=10000 以支持返回更多结果(ES默认限制为10000,如需更多需分页)
|
||||
search = AchievementDocument.search()[:10000]
|
||||
|
||||
# 使用multi_match查询,在所有字段中搜索
|
||||
search = search.query("multi_match",
|
||||
@@ -988,7 +992,7 @@ def list_registration_code_manage_requests(status: str = None, limit: int = 200)
|
||||
if status:
|
||||
must.append({"term": {"status": str(status)}})
|
||||
body = {
|
||||
"size": max(1, min(int(limit or 200), 500)),
|
||||
"size": max(1, min(int(limit or 200), 2000)),
|
||||
"query": {"bool": {"must": must}},
|
||||
"sort": [{"created_at": {"order": "desc"}}],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user