Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced filtering #183

Closed
aaronleopold opened this issue Oct 24, 2023 · 1 comment
Closed

Advanced filtering #183

aaronleopold opened this issue Oct 24, 2023 · 1 comment
Labels

Comments

@aaronleopold
Copy link
Collaborator

Recently filtering, in general, has been massively improved. I don't think it needs to be extended further for the existing GET requests, and honestly not sure it could be, but I would like to be able to someday POST to something like /media/search or /media/filter that supports VERY complex query options (AND'ing, OR'ing, NOT'ing, etc). This will probably require some VERY interesting serialization hacks. Offhand, I would imagine something like:

#[serde(untagged)]
enum Filter<T> {
    Equals(T)
    Not { not: T },
    Contains { contains: T },
    Excludes { excludes: T },
}

#[serde(untagged)]
enum FilterGroup<T> {
    And {
        and: Vec<Filter<T>>,
    },
    Or {
        or: Vec<Filter<T>>,
    },
    Not { not: Vec<Filter<T>> },
}

So an example POST body might look like:

/media/filter

{
    "and": [
        {
           "title": "Must equal this value"
        },
        {
            "status": {
                "not": "Must NOT be this value"
            }
        }
    ]
}

I'm just spitballing here though 😄. This would heavily support the development of #174

Extra context

@aaronleopold
Copy link
Collaborator Author

I have started roughing out details for this in al/smart-lists. Once the WIP implementation is more robust and worked through, I'll implement smart lists (#174) before exposing the more advanced filtering to the current UI sections for filtering.

@aaronleopold aaronleopold added this to the First stable release milestone Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant