Fixed BUG-136, now can search with a * or % as wildcards, and fix bug where no search results broke pa

This commit is contained in:
2024-12-31 15:13:17 +11:00
parent b34b71bf32
commit 37c0125fbd
4 changed files with 10 additions and 4 deletions

3
BUGs
View File

@@ -1,4 +1,4 @@
### Next: 136
### Next: 137
BUG-100: I managed to get 2 photos matching mich in the NOT_WORKING photo (probably dif refimgs but same p.tag?)
= /photos/2012/20120414-damien/IMG_8467.JPG
BUG-106: cant add trudy /pat? as refimgs via FaceDBox
@@ -25,4 +25,3 @@ BUG-132: right arrow to go to next photo in viewer ALSO scrolls to the right, ne
BUG-133: when rebuilding pa[dev], the first run fails to have symlinks to the right paths for Import/Storage, etc. a simple restart fixes - so potentially the intial copy or some other race condition?
BUG-134: when moving set of photos on page, then move another set of photos on page, the first set reappears. Could really delete them from the dom?
BUG-135: failed to rotate: 2006/20061215-ITS-xmas-KP/DSC00582.JPG - not sure why
BUG-136: cant use % explicitly in search (think its special to http, not being trapped by pa, BUT, can't use a * and convert to a % - token try did not work)

View File

@@ -234,6 +234,8 @@ def GetEntriesInFolderView( OPT, prefix ):
################################################################################
def GetEntriesInSearchView( OPT ):
search_term=OPT.orig_search_term
# turn * wildcard into sql wildcard of %
search_term=search_term.replace('*', '%' )
if 'AI:' in OPT.orig_search_term:
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}%'))"
@@ -265,6 +267,11 @@ def GetEntriesInSearchView( OPT ):
if add_it:
all_entries.append(a)
# nothing found, just return now
if len(all_entries) == 0:
OPT.num_entries = 0
return []
# for all searches first_entry is worked out when first_eid not set yet & offset is 0 and we have some entries
if OPT.first_eid == 0 and OPT.offset == 0 and len(all_entries):
OPT.first_eid = all_entries[0].id

View File

@@ -29,7 +29,7 @@
<script>
function HandleSearch()
{
st=$('#search_term').val();
st=encodeURIComponent( $('#search_term').val() )
if( st != '' ) {
document.location.href='/search/'+st
}

View File

@@ -68,7 +68,7 @@
</button>
<span class="sm-txt my-auto">&nbsp;{{OPT.how_many}} files&nbsp;</span>
{% set nxt_disabled="" %}
{% if entry_data and entry_data|length < OPT.how_many|int %}
{% if not entry_data or entry_data and entry_data|length < OPT.how_many|int %}
{% set nxt_disabled="disabled" %}
{% endif %}
<button aria-label="next" id="next" {{nxt_disabled}} name="next" class="next sm-txt btn btn-outline-secondary">