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