mirror of
https://github.com/haiwen/seahub.git
synced 2025-04-27 11:01:14 +00:00
seasearch support fulltext search (#7696)
This commit is contained in:
parent
e332873d8e
commit
cc99ce2e90
@ -716,12 +716,12 @@ def update_seasearch_index():
|
||||
def update_file_seasearch_index():
|
||||
argv = [
|
||||
Utils.get_python_executable(),
|
||||
'-m', 'seafevents.seasearch.script.repo_filename_index_local',
|
||||
'-m', 'seafevents.seasearch.script.repo_file_index_local',
|
||||
'--loglevel', 'debug',
|
||||
'update',
|
||||
]
|
||||
|
||||
Utils.info('\nUpdating seasearch filename index, this may take a while...\n')
|
||||
Utils.info('\nUpdating seasearch file index, this may take a while...\n')
|
||||
|
||||
Utils.run_argv(argv, env=get_seafes_env())
|
||||
|
||||
@ -755,12 +755,12 @@ def delete_seasearch_index():
|
||||
def delete_file_seasearch_index():
|
||||
argv = [
|
||||
Utils.get_python_executable(),
|
||||
'-m', 'seafevents.seasearch.script.repo_filename_index_local',
|
||||
'-m', 'seafevents.seasearch.script.repo_file_index_local',
|
||||
'--loglevel', 'debug',
|
||||
'clear',
|
||||
]
|
||||
|
||||
Utils.info('\nDelete seasearch filename index, this may take a while...\n')
|
||||
Utils.info('\nDelete seasearch file index, this may take a while...\n')
|
||||
|
||||
Utils.run_argv(argv, env=get_seafes_env())
|
||||
|
||||
|
@ -666,7 +666,11 @@ class Search(APIView):
|
||||
repos = [(repo.id, repo.origin_repo_id, repo.origin_path, repo.name)]
|
||||
|
||||
searched_repos, repos_map = format_repos(repos)
|
||||
results, total = ai_search_files(keyword, searched_repos, per_page, suffixes, search_path=search_path, obj_type=obj_type)
|
||||
|
||||
size_range = [size_from, size_to]
|
||||
time_range = [time_from, time_to]
|
||||
results, total = ai_search_files(keyword, searched_repos, per_page, suffixes,
|
||||
search_path=search_path, obj_type=obj_type, time_range=time_range, size_range=size_range)
|
||||
|
||||
for f in results:
|
||||
repo_id = f['repo_id']
|
||||
|
@ -210,7 +210,7 @@ def search_wikis(wiki_id, keyword, count):
|
||||
return es_wiki_search(wiki_id, keyword, count)
|
||||
|
||||
|
||||
def ai_search_files(keyword, searched_repos, count, suffixes, search_path=None, obj_type=None):
|
||||
def ai_search_files(keyword, searched_repos, count, suffixes, search_path=None, obj_type=None, time_range=None, size_range=None):
|
||||
params = {
|
||||
'query': keyword,
|
||||
'repos': searched_repos,
|
||||
@ -222,6 +222,10 @@ def ai_search_files(keyword, searched_repos, count, suffixes, search_path=None,
|
||||
params['search_path'] = search_path
|
||||
if obj_type:
|
||||
params['obj_type'] = obj_type
|
||||
if time_range:
|
||||
params['time_range'] = time_range
|
||||
if size_range:
|
||||
params['size_range'] = size_range
|
||||
|
||||
resp = search(params)
|
||||
if resp.status_code == 500:
|
||||
|
Loading…
Reference in New Issue
Block a user