mirror of
https://github.com/haiwen/seahub.git
synced 2025-04-27 11:01:14 +00:00
fix(seasearch): fix wiki can be searched (#6655)
* fix(seasearch): fix wiki can be searched * fix wiki can be searched in es * optimize query repo commit * update * update --------- Co-authored-by: ‘JoinTyang’ <yangtong1009@163.com>
This commit is contained in:
parent
ca7dae1e62
commit
98ca58df77
@ -29,7 +29,12 @@ def restore_all_repo():
|
||||
else:
|
||||
if len(repo_commits) == 0:
|
||||
break
|
||||
for repo_id, commit_id in repo_commits:
|
||||
repo_ids = [repo[0] for repo in repo_commits if repo[2] != 'wiki']
|
||||
virtual_repos = repo_data.get_virtual_repo_in_repos(repo_ids)
|
||||
virtual_repo_set = {repo[0] for repo in virtual_repos}
|
||||
for repo_id, commit_id, repo_type in repo_commits:
|
||||
if repo_id in virtual_repo_set or repo_type == 'wiki':
|
||||
continue
|
||||
put_to_redis(repo_id, commit_id)
|
||||
start += 1000
|
||||
|
||||
|
@ -299,6 +299,9 @@ def get_search_repos(username, org_id):
|
||||
|
||||
repo_id_set = set()
|
||||
for repo in repo_list:
|
||||
# Skip the special repo
|
||||
if repo.repo_type == REPO_TYPE_WIKI:
|
||||
continue
|
||||
repo_id = repo.id
|
||||
if repo.origin_repo_id:
|
||||
repo_id = repo.origin_repo_id
|
||||
|
@ -53,7 +53,7 @@ from seahub.base.templatetags.seahub_tags import email2nickname, \
|
||||
translate_seahub_time, translate_commit_desc_escape, \
|
||||
email2contact_email
|
||||
from seahub.constants import PERMISSION_READ_WRITE, PERMISSION_PREVIEW_EDIT, \
|
||||
PERMISSION_INVISIBLE
|
||||
PERMISSION_INVISIBLE, REPO_TYPE_WIKI
|
||||
from seahub.group.views import remove_group_common, \
|
||||
rename_group_with_new_name, is_group_staff
|
||||
from seahub.group.utils import BadGroupNameError, ConflictGroupNameError, \
|
||||
@ -581,7 +581,8 @@ class Search(APIView):
|
||||
repo_id = search_repo
|
||||
repo = seafile_api.get_repo(repo_id)
|
||||
# recourse check
|
||||
if not repo:
|
||||
# Skip specical repo
|
||||
if not repo or repo.repo_type == REPO_TYPE_WIKI:
|
||||
error_msg = 'Library %s not found.' % repo_id
|
||||
return api_error(status.HTTP_404_NOT_FOUND, error_msg)
|
||||
|
||||
|
@ -13,6 +13,7 @@ from seahub.utils.file_types import IMAGE, DOCUMENT, SPREADSHEET, SVG, PDF, \
|
||||
from seahub.utils import get_user_repos
|
||||
from seahub.base.templatetags.seahub_tags import email2nickname, \
|
||||
email2contact_email
|
||||
from seahub.constants import REPO_TYPE_WIKI
|
||||
|
||||
import seaserv
|
||||
from seaserv import seafile_api
|
||||
@ -124,6 +125,9 @@ def get_search_repos_map(search_repo, username, org_id, shared_from, not_shared_
|
||||
repo_type_map.update(get_repo_type_map(group_repos, 'group'))
|
||||
|
||||
for repo in repo_list:
|
||||
# Skip the special repo
|
||||
if repo.repo_type == REPO_TYPE_WIKI:
|
||||
continue
|
||||
subrepo_tag = False
|
||||
search_repo_id = repo.id
|
||||
if repo.origin_repo_id:
|
||||
|
Loading…
Reference in New Issue
Block a user