-
-
Notifications
You must be signed in to change notification settings - Fork 411
Open
Labels
Priority: HighAn important issue requiring attentionAn important issue requiring attentionTagStudio: LibraryRelating to the TagStudio library systemRelating to the TagStudio library systemTagStudio: SearchThe TagStudio search engineThe TagStudio search engineType: EnhancementNew feature or requestNew feature or request
Milestone
Description
Similar issues
This feature is considered to be one of "Priority Features" by readme, yet I did not find any opened issues on that topic. Although I found a pull request #190, which could make use of parsing field names from search query.
Suggestions
I did not check contributing rules beforehand, so I accidentally started working on issue beforehand. Here is snippet from my fork:
def parse_metadata(self, query: str | None = None) \
-> list[dict[str, str | list[str]]]:
"""
Splits query into several maps 'meta_key -> value'\n
Values without specified key parsed as tags and put in 'unbound' key \n
example query1:
"meta_first: value; meta_second: value; tag1;\
| meta_first: value; meta_second: value; notag;"
example query2:
"tag1 | notag | tag2"
"""
if query is None:
return {}
meta_list: list = []
meta_conditions = query.strip().split("|")
for meta_condition in meta_conditions:
meta_to_value: dict = {}
field_data_list = meta_condition.strip().split(";")
print(field_data_list)
for field_data in field_data_list:
field_parsed = field_data.strip().split(":")
if len(field_parsed) < 2:
unbound_values = field_parsed[0].strip().split(' ')
if meta_to_value.get('unbound') is None:
meta_to_value['unbound'] = unbound_values
else:
meta_to_value['unbound'].append(unbound_values)
continue
if len(field_parsed) != 2:
logging.warning("""[ERROR] Attempt to parse mutiple fields\
as one! Do not forget to specify ';'\
between different meta fields""")
meta_to_value[field_parsed[0].lower()] = field_parsed[1].lower()
meta_list.append(meta_to_value)
logging.info("Parsed values: ",meta_list)
return meta_list
Current state
I have tried to not touch much of code in Library.search_library
, only add few new functions to allow additional entries to be filtered, but all other features should have stayed the same.
I planned to open a pull request straight up, but it is explicitly specified new issue to be opened beforehand, so let me know if is ok to go forward with this
CyanVoxel
Metadata
Metadata
Assignees
Labels
Priority: HighAn important issue requiring attentionAn important issue requiring attentionTagStudio: LibraryRelating to the TagStudio library systemRelating to the TagStudio library systemTagStudio: SearchThe TagStudio search engineThe TagStudio search engineType: EnhancementNew feature or requestNew feature or request
Type
Projects
Status
π Ready for Development