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