Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A administrate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 96
    • Issues 96
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 32
    • Merge requests 32
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • thoughtbot, inc.
  • administrate
  • Merge requests
  • !1218

"Advanced" search

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/patrick-gleeson/feature/advanced-search into master Sep 19, 2018
  • Overview 14
  • Commits 2
  • Pipelines 0
  • Changes 2

Created by: patrick-gleeson

Forgive a rather presumptuous PR. I know that #157 (closed) is open and there has not been a general agreement on exactly what smart searching would look like.

I just needed more advanced search functionality for a site I'm building, and so I built what I need, and I want to see if anyone else would find it useful.

How this works:

Suppose you have a User class with the following in its Administrate dashboard

ATTRIBUTE_TYPES = {
  name: Field::String,
  email: Field::String,
  activated: Field::Boolean
}

Search term: name:Steve

  • This will search for 'steve' in the name field

Search term: name:Steve example

  • This will search for 'steve' in the name field and 'example' in everything searchable except the name field

Search term: name:'Steve Jones'

  • This will search for 'steve jones' in the name field

Search term: activated:true

  • This will search for records with activated set to true

Search term: email:example.com name:"Steve Jones" activated:false hoopla

  • This will search for records where email matches 'example.com', name matches 'Steve Jones', activated is set to true, and it will ignore 'hoopla' because there are no fields left for it to search.

I look forward to any thoughts and feedback!

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/patrick-gleeson/feature/advanced-search