If specific meta search finds nothing, make unspecfic meta search.
This commit is contained in:
parent
527f006e6b
commit
291fffe057
13
image-index
13
image-index
|
@ -244,9 +244,10 @@ class metatable(database):
|
|||
self.collist=["NAME","ALIAS"]
|
||||
super().__init__(filepath)
|
||||
|
||||
def add_index(self,val,alias):
|
||||
randhex=get_randhex()
|
||||
val=re.sub('[ ?!/\\:!*"<>|]', '', val)
|
||||
def add_index(self,val,alias,randhex=None):
|
||||
if not randhex:
|
||||
randhex=get_randhex()
|
||||
val=re.sub('[ ,?!/\\:!*"<>|]', '', val)
|
||||
super().add_index([val[:8] + "-" + randhex,alias])
|
||||
|
||||
def check_index(self,typ):
|
||||
|
@ -282,6 +283,12 @@ class metatable(database):
|
|||
def search_index(self,args,quiet=True):
|
||||
selection=[]
|
||||
selection=self.sql_compare_list("*", [args], selection,True)
|
||||
if selection[0] == ".":
|
||||
slist=args.split(" ")
|
||||
selection=self.sql_compare_list("*", slist, [],False)
|
||||
if len(selection) > 1:
|
||||
print("Please enter a more specific search query!")
|
||||
return "."
|
||||
selection=self.select_index(selection,quiet)
|
||||
return selection
|
||||
|
||||
|
|
Loading…
Reference in a new issue