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

Exact match when searching for custom field #1693

Closed
cimnine opened this issue Nov 7, 2017 · 4 comments
Closed

Exact match when searching for custom field #1693

cimnine opened this issue Nov 7, 2017 · 4 comments
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application

Comments

@cimnine
Copy link
Contributor

cimnine commented Nov 7, 2017

Issue type

[X] Feature request
[ ] Bug report
[ ] Documentation

Environment

  • Python version: 2.7
  • NetBox version: 2.2.4

Description

  • Create a custom field:
    • Objects: dcim > rack
    • Type: Text
    • Name: test1
    • Is filterable: ✔️
  • Take two racks and set the value of the custom field as follows:
    • Rack 1: urn:bla:1
    • Rack 2: urn:bla:100
  • Go to the rack overview and put a urn:bla:1 into the filter for the custom field

Expectation: I get one result.
Current behaviour: I get two results.

Suggestions

I suggest that all filtering on fields become exact and at the same time introducing a wildcard character for fuzzy searches, e.g. *. (E.g. urn:bla:1 would only match the one rack, whereas urn:bla:1* would still match both racks.)

An alternative suggestion is to add an option to the custom field's definition: Shall that field match exactly or not. (Similar to the "Is filterable" checkbox.)

Another alternative suggestion is to support the Google syntax for exact matches, i.e. everything that's wrapped in " must be an exact match. (E.g. "urn:bla:1" would only match the one rack, whereas urn:bla:1 would still match both racks.)

@cimnine
Copy link
Contributor Author

cimnine commented Nov 7, 2017

Some context

We're using custom fields to represent the IDs of our legacy system, which happen to be URNs. (These are all over the place, so we have to stick with them for a long time.) Currently, I'm writing a tool that copies any rack from the legacy system to Netbox and updates all racks already existing in Netbox based on the custom field. Hence I would appreciate if I could have a way to do exact-match lookups on custom fields.

@troxil
Copy link

troxil commented Nov 9, 2017

@cimnine Isn't this how all existing filtering works? It's not exact at all. Prefixes, devices etc.

@cimnine
Copy link
Contributor Author

cimnine commented Nov 10, 2017

Thanks for pointing this out, @troxil. I've changed it from a bug report to feature request.

@jeremystretch
Copy link
Member

An alternative suggestion is to add an option to the custom field's definition: Shall that field match exactly or not. (Similar to the "Is filterable" checkbox.)

This seems like a favorable approach over introducing a potentially ambiguous wildcard approach.

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application labels Feb 21, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

3 participants