Enhance VLAN search #10974

Closed
opened 2025-12-29 21:38:39 +01:00 by adam · 7 comments
Owner

Originally created by @1024834 on GitHub (Apr 1, 2025).

NetBox version

v4.2.5

Feature type

Change to existing functionality

Proposed functionality

Make the VLAN search return all VLANs that start with the entered string. Entering "33" for example should return every VLAN with an ID from 3300 to 3399.

Currently, it returns only a few VLANs with no obvious selection.

Use case

This eases searching for VLANs that have not been added to a VLAN group.

Database changes

No response

External dependencies

No response

Originally created by @1024834 on GitHub (Apr 1, 2025). ### NetBox version v4.2.5 ### Feature type Change to existing functionality ### Proposed functionality Make the VLAN search return all VLANs that start with the entered string. Entering "33" for example should return every VLAN with an ID from 3300 to 3399. Currently, it returns only a few VLANs with no obvious selection. ### Use case This eases searching for VLANs that have not been added to a VLAN group. ### Database changes _No response_ ### External dependencies _No response_
adam added the type: feature label 2025-12-29 21:38:39 +01:00
adam closed this issue 2025-12-29 21:38:39 +01:00
Author
Owner

@jnovinger commented on GitHub (Apr 1, 2025):

Comes from bug #19047 .

@jnovinger commented on GitHub (Apr 1, 2025): Comes from bug #19047 .
Author
Owner

@jeremystretch commented on GitHub (Apr 1, 2025):

This should be considered an anti-pattern IMO. I can't imagine a scenario where you want to match all of e.g. VLANs 33, 533, 1332, 2033, 3300, etc. NetBox provides greater than & less than lookups on the VID filter: These should be used instead of trying to perform a partial match on the VID as a string.

@jeremystretch commented on GitHub (Apr 1, 2025): This should be considered an anti-pattern IMO. I can't imagine a scenario where you want to match all of e.g. VLANs 33, 533, 1332, 2033, 3300, etc. NetBox provides greater than & less than lookups on the VID filter: These should be used instead of trying to perform a partial match on the VID as a string.
Author
Owner

@1024834 commented on GitHub (Apr 2, 2025):

This should be considered an anti-pattern IMO. I can't imagine a scenario where you want to match all of e.g. VLANs 33, 533, 1332, 2033, 3300, etc. NetBox provides greater than & less than lookups on the VID filter: These should be used instead of trying to perform a partial match on the VID as a string.

@jeremystretch
But that's not what I proposed. It should match every VLAN whose ID starts with the entered string. So, 33*, not *33*.

Right now, it does match some VLANs that start with the entered string, but it's not obvious why exactly these are displayed and not the others too. If there's an exact match, that one is displayed first currently and that is fine. But it makes no sense not to show the others too imho.

@1024834 commented on GitHub (Apr 2, 2025): > This should be considered an anti-pattern IMO. I can't imagine a scenario where you want to match all of e.g. VLANs 33, 533, 1332, 2033, 3300, etc. NetBox provides greater than & less than lookups on the VID filter: These should be used instead of trying to perform a partial match on the VID as a string. @jeremystretch But that's not what I proposed. It should match every VLAN whose ID **starts** with the entered string. So, 33*, not \*33\*. Right now, it does match some VLANs that start with the entered string, but it's not obvious why exactly these are displayed and not the others too. If there's an exact match, that one is displayed first currently and that is fine. But it makes no sense not to show the others too imho.
Author
Owner

@jeremystretch commented on GitHub (Apr 2, 2025):

Same concept applies. Why would you not use the filters provided expressly for this purpose?

@jeremystretch commented on GitHub (Apr 2, 2025): Same concept applies. Why would you not use the filters provided expressly for this purpose?
Author
Owner

@jeremystretch commented on GitHub (Apr 2, 2025):

Right now, it does match some VLANs that start with the entered string, but it's not obvious why exactly these are displayed and not the others too.

It's matching on string values in other fields, not the VLAN ID.

@jeremystretch commented on GitHub (Apr 2, 2025): > Right now, it does match some VLANs that start with the entered string, but it's not obvious why exactly these are displayed and not the others too. It's matching on string values in other fields, not the VLAN ID.
Author
Owner

@1024834 commented on GitHub (Apr 2, 2025):

Same concept applies. Why would you not use the filters provided expressly for this purpose?

I can't find this feature. The VLAN ID field in filters won't let me enter '<','>' or anything and won't execute a search with a '-' in it. There's no documentation about that either. It would be much more convenient to be able to quicksearch VLAN's by their ID anyway. We haven't ever searched for a VLAN by its name.

@1024834 commented on GitHub (Apr 2, 2025): > Same concept applies. Why would you not use the filters provided expressly for this purpose? I can't find this feature. The VLAN ID field in filters won't let me enter '<','>' or anything and won't execute a search with a '-' in it. There's no documentation about that either. It would be much more convenient to be able to quicksearch VLAN's by their ID anyway. We haven't ever searched for a VLAN by its name.
Author
Owner

@bctiemann commented on GitHub (Apr 3, 2025):

I can't find this feature. The VLAN ID field in filters won't let me enter '<','>' or anything and won't execute a search with a '-' in it. There's no documentation about that either. It would be much more convenient to be able to quicksearch VLAN's by their ID anyway. We haven't ever searched for a VLAN by its name.

You can use __lt and __gt filters (manually specifying in the URL). There is an open FR to add these filters to the form: https://github.com/netbox-community/netbox/issues/7604

@bctiemann commented on GitHub (Apr 3, 2025): > I can't find this feature. The VLAN ID field in filters won't let me enter '<','>' or anything and won't execute a search with a '-' in it. There's no documentation about that either. It would be much more convenient to be able to quicksearch VLAN's by their ID anyway. We haven't ever searched for a VLAN by its name. You can use `__lt` and `__gt` filters (manually specifying in the URL). There is an open FR to add these filters to the form: https://github.com/netbox-community/netbox/issues/7604
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10974