mirror of
https://github.com/TagStudioDev/TagStudio.git
synced 2026-02-02 08:09:13 +00:00
finish refactoring of FilterState
This commit is contained in:
@@ -72,23 +72,9 @@ class FilterState:
|
||||
page_size: int | None = 500
|
||||
|
||||
# these should be erased on update
|
||||
# whole path
|
||||
path: Path | str | None = None
|
||||
|
||||
# Abstract Syntax Tree Of the current Search Query
|
||||
ast: Query = None
|
||||
|
||||
def __post_init__(self):
|
||||
# strip values automatically
|
||||
|
||||
query = None
|
||||
|
||||
if self.path is not None:
|
||||
query = f"path:'{str(self.path).strip()}'"
|
||||
|
||||
if query is not None:
|
||||
self.ast = Parser(query).parse()
|
||||
|
||||
@property
|
||||
def limit(self):
|
||||
return self.page_size
|
||||
|
||||
@@ -447,9 +447,6 @@ class Library:
|
||||
.outerjoin(TagAlias)
|
||||
.where(SQLBoolExpressionBuilder().visit(search.ast))
|
||||
)
|
||||
elif search.path:
|
||||
search_str = str(search.path).replace("*", "%")
|
||||
statement = statement.where(Entry.path.ilike(search_str))
|
||||
|
||||
extensions = self.prefs(LibraryPrefs.EXTENSION_LIST)
|
||||
is_exclude_list = self.prefs(LibraryPrefs.IS_EXCLUDE_LIST)
|
||||
|
||||
Reference in New Issue
Block a user