Compare commits
2 Commits
4556afb3bb
...
9ffb704648
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ffb704648 | |||
| 27e06a9462 |
10
files.py
10
files.py
@@ -380,7 +380,7 @@ def GetSearchQueryData(OPT):
|
|||||||
search_term = OPT.search_term
|
search_term = OPT.search_term
|
||||||
# turn * wildcard into sql wildcard of %
|
# turn * wildcard into sql wildcard of %
|
||||||
search_term = search_term.replace('*', '%')
|
search_term = search_term.replace('*', '%')
|
||||||
if 'AI:' in search_term:
|
if 'AI:' in OPT.search_term:
|
||||||
search_term = search_term.replace('AI:', '')
|
search_term = search_term.replace('AI:', '')
|
||||||
|
|
||||||
# AI searches are for specific ppl/joins in the DB AND we do them for ALL types of searches, define this once
|
# AI searches are for specific ppl/joins in the DB AND we do them for ALL types of searches, define this once
|
||||||
@@ -391,7 +391,7 @@ def GetSearchQueryData(OPT):
|
|||||||
.order_by(*order_map.get(OPT.noo) )
|
.order_by(*order_map.get(OPT.noo) )
|
||||||
)
|
)
|
||||||
|
|
||||||
if 'AI:' in search_term:
|
if 'AI:' in OPT.search_term:
|
||||||
all_entries = db.session.execute(ai_query).scalars().all()
|
all_entries = db.session.execute(ai_query).scalars().all()
|
||||||
else:
|
else:
|
||||||
# match name of File
|
# match name of File
|
||||||
@@ -399,9 +399,11 @@ def GetSearchQueryData(OPT):
|
|||||||
# match name of Dir
|
# match name of Dir
|
||||||
dir_query = select(Entry.id).join(File).join(EntryDirLink).join(Dir).where(Dir.rel_path.ilike(f'%{search_term}%')).order_by(*order_map.get(OPT.noo))
|
dir_query = select(Entry.id).join(File).join(EntryDirLink).join(Dir).where(Dir.rel_path.ilike(f'%{search_term}%')).order_by(*order_map.get(OPT.noo))
|
||||||
|
|
||||||
|
ai_entries = db.session.execute(ai_query).scalars().all()
|
||||||
|
file_entries = db.session.execute(file_query).scalars().all()
|
||||||
|
dir_entries = db.session.execute(dir_query).scalars().all()
|
||||||
# Combine ai, file & dir matches with union() to dedup and then order them
|
# Combine ai, file & dir matches with union() to dedup and then order them
|
||||||
combined_query = union( file_query, dir_query, ai_query )
|
all_entries = list(dict.fromkeys(ai_entries + dir_entries + file_entries))
|
||||||
all_entries = db.session.execute(combined_query).scalars().all()
|
|
||||||
|
|
||||||
query_data['entry_list']=all_entries
|
query_data['entry_list']=all_entries
|
||||||
return query_data
|
return query_data
|
||||||
|
|||||||
@@ -700,11 +700,9 @@ function isMobile() {
|
|||||||
// when we change one of the options (noo, how_many, folders) - then update '{how_many} files' str,
|
// when we change one of the options (noo, how_many, folders) - then update '{how_many} files' str,
|
||||||
// tweak noo menu for folders/flat view then reset the page contents based on current OPT values
|
// tweak noo menu for folders/flat view then reset the page contents based on current OPT values
|
||||||
function changeOPT(successCallback) {
|
function changeOPT(successCallback) {
|
||||||
var old_how_many=OPT.how_many
|
|
||||||
OPT.how_many=$('#how_many').val()
|
OPT.how_many=$('#how_many').val()
|
||||||
// if we change how_many invalidate page cache as page size is different now
|
// changes invalidate page cache so clear it out
|
||||||
if( OPT.how_many != old_how_many )
|
document.page.length=0
|
||||||
document.page.length=0
|
|
||||||
new_f=$('#folders').val()
|
new_f=$('#folders').val()
|
||||||
new_f=( new_f == 'True' )
|
new_f=( new_f == 'True' )
|
||||||
// if change to/from folders, also fix the noo menu
|
// if change to/from folders, also fix the noo menu
|
||||||
|
|||||||
Reference in New Issue
Block a user