perf: 修改搜索

pull/12394/head
ibuler 2023-12-20 20:49:50 +08:00 committed by Bryan
parent 4d15e46ceb
commit 88b9a4d693
3 changed files with 5 additions and 4 deletions

View File

@ -69,7 +69,7 @@ def digest_sql_query():
for query in queries:
sql = query['sql']
# print(" # {}: {}".format(query['time'], sql))
print(" # {}: {}".format(query['time'], sql))
if len(queries) < 3:
continue
print("- Table: {}".format(table_name))
@ -77,7 +77,7 @@ def digest_sql_query():
sql = query['sql']
if not sql or not sql.startswith('SELECT'):
continue
# print('\t{}. {}'.format(i, sql))
print('\t{}. {}'.format(i, sql))
logger.debug(">>> [{}] {}".format(method, path))
for name, counter in counters:

View File

@ -129,6 +129,7 @@ class LabeledResourceViewSet(OrgBulkModelViewSet):
}
ordering_fields = ('res_type', 'date_created')
# Todo: 这里需要优化,查询 sql 太多
def filter_search(self, queryset):
keyword = self.request.query_params.get('search')
if not keyword:

View File

@ -40,5 +40,5 @@ class LabeledResource(JMSOrgBaseModel):
unique_together = [('label', 'res_type', 'res_id', 'org_id')]
verbose_name = _('Labeled resource')
# def __str__(self):
# return '{} => {}'.format(self.label, self.resource)
def __str__(self):
return '{} => {}'.format(self.label, self.resource)