next-admin icon indicating copy to clipboard operation
next-admin copied to clipboard

[FEATURE] - Add support for an Advanced Search

Open malaney opened this issue 1 year ago • 2 comments

Summary

Currently next-admin supports searching against a single string input across numerous fields, which is great. But often times our admin panels require search across multiple conditions with multiple data types. For example:

const result = await prisma.post.findMany({
  where: {
    AND: [
      {
        content: {
          contains: 'Prisma',
        },
      },
      {
        published: {
          equals: false,
        },
      },
    ],
  },
})

Could we add support for an Advanced Search that allows users to define search fields (i.e. "content" and "published") as well as data types (i.e. "string" and "boolean") and perhaps even a comparator (i.e. lt, gt, lte, gte, etc ...).

Thank you for considering this. Next-Admin is outstanding!!

Basic Example

As a user I'd like to be able to narrow the Posts results down to entries by author "Morrison" published after "2016".

Drawbacks

Can't think of any real drawbacks. But the advanced search would most likely need to appear in a new modal and that may be tricky for mobile first designs.

Unresolved questions

No response

malaney avatar Jun 10 '24 03:06 malaney

Hello

Thank you for the issue, this is something that is in the pipeline, we are thinking about how to implement it in the best possible way. A first step to this was to add the custom filters property. Next step is to add a more complex query builder which should fit any use case for the queries

foyarash avatar Jun 10 '24 08:06 foyarash

This is actually related to #326

foyarash avatar Jun 10 '24 08:06 foyarash

Closing in favor of #326

foyarash avatar Sep 04 '24 15:09 foyarash