made AI:<tag> be literal, e.g. no wildcards to stop AI:kath matching AI:katherine, also removed unused fid var and commented out debugs
This commit is contained in:
20
files.py
20
files.py
@@ -238,7 +238,9 @@ def GetEntriesInSearchView( OPT ):
|
|||||||
search_term=search_term.replace('*', '%' )
|
search_term=search_term.replace('*', '%' )
|
||||||
if 'AI:' in OPT.orig_search_term:
|
if 'AI:' in OPT.orig_search_term:
|
||||||
search_term = search_term.replace('AI:','')
|
search_term = search_term.replace('AI:','')
|
||||||
join=f"Entry.query.join(File).join(FaceFileLink).join(Face).join(FaceRefimgLink).join(Refimg).join(PersonRefimgLink).join(Person).filter(Person.tag.ilike('%{search_term}%'))"
|
join=f"Entry.query.join(File).join(FaceFileLink).join(Face).join(FaceRefimgLink).join(Refimg).join(PersonRefimgLink).join(Person).filter(Person.tag == search_term)"
|
||||||
|
else:
|
||||||
|
join=f"Entry.query.join(File).join(FaceFileLink).join(Face).join(FaceRefimgLink).join(Refimg).join(PersonRefimgLink).join(Person).filter(Person.tag.ilike('%{search_term}%'))"
|
||||||
if 'AI:' in OPT.orig_search_term:
|
if 'AI:' in OPT.orig_search_term:
|
||||||
all_entries = eval( f"{join}.{OPT.order}.offset(OPT.offset).limit(OPT.how_many).all()")
|
all_entries = eval( f"{join}.{OPT.order}.offset(OPT.offset).limit(OPT.how_many).all()")
|
||||||
else:
|
else:
|
||||||
@@ -448,7 +450,10 @@ def files_rbp():
|
|||||||
@app.route("/search/<search_term>", methods=["GET", "POST"])
|
@app.route("/search/<search_term>", methods=["GET", "POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def search(search_term):
|
def search(search_term):
|
||||||
|
print( f"req={request}" )
|
||||||
OPT=States( request )
|
OPT=States( request )
|
||||||
|
print( f"OPT={OPT}" )
|
||||||
|
|
||||||
# if we posted to get here, its a change in State, so save it to pa_user_state, and go back to the GET version or URL
|
# if we posted to get here, its a change in State, so save it to pa_user_state, and go back to the GET version or URL
|
||||||
if request.method=="POST":
|
if request.method=="POST":
|
||||||
redirect("/search/"+search_term)
|
redirect("/search/"+search_term)
|
||||||
@@ -620,7 +625,6 @@ def view_list():
|
|||||||
resp['objs'][e.id]['faces'] = []
|
resp['objs'][e.id]['faces'] = []
|
||||||
|
|
||||||
# put face data back into array format (for js processing)
|
# put face data back into array format (for js processing)
|
||||||
fid=0
|
|
||||||
for face in e.file_details.faces:
|
for face in e.file_details.faces:
|
||||||
fd= {}
|
fd= {}
|
||||||
fd['x'] = face.face_left
|
fd['x'] = face.face_left
|
||||||
@@ -628,10 +632,10 @@ def view_list():
|
|||||||
fd['w'] = face.w
|
fd['w'] = face.w
|
||||||
fd['h'] = face.h
|
fd['h'] = face.h
|
||||||
if face.refimg:
|
if face.refimg:
|
||||||
|
fd['pid'] = face.refimg.person.id
|
||||||
fd['who'] = face.refimg.person.tag
|
fd['who'] = face.refimg.person.tag
|
||||||
fd['distance'] = round(face.refimg_lnk.face_distance,2)
|
fd['distance'] = round(face.refimg_lnk.face_distance,2)
|
||||||
resp['objs'][e.id]['faces'].append(fd)
|
resp['objs'][e.id]['faces'].append(fd)
|
||||||
fid+=1
|
|
||||||
|
|
||||||
eids=eids.rstrip(",")
|
eids=eids.rstrip(",")
|
||||||
lst = eids.split(',')
|
lst = eids.split(',')
|
||||||
@@ -648,12 +652,12 @@ def view_list():
|
|||||||
resp['last_eid']=OPT.last_eid
|
resp['last_eid']=OPT.last_eid
|
||||||
resp['eids']=eids
|
resp['eids']=eids
|
||||||
resp['offset']=OPT.offset
|
resp['offset']=OPT.offset
|
||||||
print( f"BUG-DEBUG: /view_list route #1 - OPT={OPT}, eids={eids} ")
|
# print( f"BUG-DEBUG: /view_list route #1 - OPT={OPT}, eids={eids} ")
|
||||||
# save pref to keep the new current value, first/last
|
# save pref to keep the new current value, first/last
|
||||||
pref=PA_UserState.query.filter(PA_UserState.pa_user_dn==current_user.dn,PA_UserState.orig_ptype==OPT.orig_ptype,PA_UserState.view_eid==OPT.view_eid).first()
|
pref=PA_UserState.query.filter(PA_UserState.pa_user_dn==current_user.dn,PA_UserState.orig_ptype==OPT.orig_ptype,PA_UserState.view_eid==OPT.view_eid).first()
|
||||||
print( f"BUG-DEBUG: /view_list route #2 - OPT={OPT}, eids={eids} ")
|
# print( f"BUG-DEBUG: /view_list route #2 - OPT={OPT}, eids={eids} ")
|
||||||
UpdatePref( pref, OPT )
|
UpdatePref( pref, OPT )
|
||||||
print( f"BUG-DEBUG: /view_list route #3 - OPT={OPT}, eids={eids} ")
|
# print( f"BUG-DEBUG: /view_list route #3 - OPT={OPT}, eids={eids} ")
|
||||||
|
|
||||||
return make_response( resp )
|
return make_response( resp )
|
||||||
|
|
||||||
@@ -701,7 +705,7 @@ def view(id):
|
|||||||
imp_path = setting.import_path
|
imp_path = setting.import_path
|
||||||
st_path = setting.storage_path
|
st_path = setting.storage_path
|
||||||
bin_path = setting.recycle_bin_path
|
bin_path = setting.recycle_bin_path
|
||||||
print( f"BUG-DEBUG: /view/id GET route - OPT={OPT}, eids={eids}, current={int(id)} ")
|
# print( f"BUG-DEBUG: /view/id GET route - OPT={OPT}, eids={eids}, current={int(id)} ")
|
||||||
return render_template("viewer.html", current=int(id), eids=eids, objs=objs, OPT=OPT, NMO_data=NMO_data, imp_path=imp_path, st_path=st_path, bin_path=bin_path )
|
return render_template("viewer.html", current=int(id), eids=eids, objs=objs, OPT=OPT, NMO_data=NMO_data, imp_path=imp_path, st_path=st_path, bin_path=bin_path )
|
||||||
|
|
||||||
##################################################################################
|
##################################################################################
|
||||||
@@ -712,7 +716,7 @@ def view(id):
|
|||||||
def view_img_post(id):
|
def view_img_post(id):
|
||||||
# set pa_user_states...
|
# set pa_user_states...
|
||||||
OPT=States( request )
|
OPT=States( request )
|
||||||
print( f"BUG-DEBUG: /view/id POST route - OPT={OPT}, id={id} ")
|
# print( f"BUG-DEBUG: /view/id POST route - OPT={OPT}, id={id} ")
|
||||||
# then use back-button friendly URL (and use pa_user_states to view the right image in the right list
|
# then use back-button friendly URL (and use pa_user_states to view the right image in the right list
|
||||||
return redirect( "/view/" + id );
|
return redirect( "/view/" + id );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user