Expand search to description and comment fields #267

Closed
opened 2025-12-29 16:20:20 +01:00 by adam · 9 comments
Owner

Originally created by @JosephRPalmer on GitHub (Jul 21, 2016).

It would be great if IPs were searchable by description for implementations with large numbers of IP addresses.

Originally created by @JosephRPalmer on GitHub (Jul 21, 2016). It would be great if IPs were searchable by description for implementations with large numbers of IP addresses.
adam added the type: feature label 2025-12-29 16:20:20 +01:00
adam closed this issue 2025-12-29 16:20:21 +01:00
Author
Owner

@ryanmerolle commented on GitHub (Jul 21, 2016):

This probably ties int #166

@ryanmerolle commented on GitHub (Jul 21, 2016): This probably ties int #166
Author
Owner

@farewelldave commented on GitHub (Jul 21, 2016):

Yes, this would be great!

@farewelldave commented on GitHub (Jul 21, 2016): Yes, this would be great!
Author
Owner

@malaiam commented on GitHub (Jul 27, 2016):

I just hit this while trying the demo, the search should be really flexible IMHO, almost google like. No matter what you search you should get results in all fields and categories, saving you search in different fields, or making mistakes.

@malaiam commented on GitHub (Jul 27, 2016): I just hit this while trying the demo, the search should be really flexible IMHO, almost google like. No matter what you search you should get results in all fields and categories, saving you search in different fields, or making mistakes.
Author
Owner

@jeremystretch commented on GitHub (Jul 29, 2016):

I've expanded the scope of this issue to include all objects.

@jeremystretch commented on GitHub (Jul 29, 2016): I've expanded the scope of this issue to include all objects.
Author
Owner

@jeremystretch commented on GitHub (Jul 29, 2016):

38aee33df0 added the following fields to the "q" search filter:

  • Circuits
    • Provider: comments
    • Ciruit: comments, pp_info, xconnect_id
  • DCIM
    • Site: comments
    • Rack: comments
    • Device: comments
  • IPAM
    • VRF: RD, description (new filter)
    • Aggregate: prefix, description (new filter)
    • Prefix: description
    • IPAddress: description
    • VLAN: VID, name, description (new filter)
  • Secrets
    • Secret: name, device.name (new filter)
  • Tenancy
    • Tenant: description, comments
@jeremystretch commented on GitHub (Jul 29, 2016): 38aee33df01ccddb35607bebdbfe233f857c78dd added the following fields to the "q" search filter: - Circuits - Provider: comments - Ciruit: comments, pp_info, xconnect_id - DCIM - Site: comments - Rack: comments - Device: comments - IPAM - VRF: RD, description (new filter) - Aggregate: prefix, description (new filter) - Prefix: description - IPAddress: description - VLAN: VID, name, description (new filter) - Secrets - Secret: name, device.name (new filter) - Tenancy - Tenant: description, comments
Author
Owner

@wzyboy commented on GitHub (Aug 2, 2016):

Thanks for adding additional search fields!

We are now using NetBox as a data source for provisioning system. We import server serial numbers and (pre-allocated) IP addresses into NetBox and boot bare-metal servers with PXE (with DHCP temporary IP addresses). A Python script in PXE live system would first collect server serial number (with dmidecode -s system-serial-number) before querying NetBox for permanent IP address of that server for provisioning purpose.

It would be great if serial number could be added as a search field for devices. Thanks!

@wzyboy commented on GitHub (Aug 2, 2016): Thanks for adding additional search fields! We are now using NetBox as a data source for provisioning system. We import server serial numbers and (pre-allocated) IP addresses into NetBox and boot bare-metal servers with PXE (with DHCP temporary IP addresses). A Python script in PXE live system would first collect server serial number (with `dmidecode -s system-serial-number`) before querying NetBox for permanent IP address of that server for provisioning purpose. It would be great if serial number could be added as a search field for devices. Thanks!
Author
Owner

@wzyboy commented on GitHub (Aug 2, 2016):

To be clear, I mean the /api/dcim/devices/ API.

@wzyboy commented on GitHub (Aug 2, 2016): To be clear, I mean the `/api/dcim/devices/` API.
Author
Owner

@jeremystretch commented on GitHub (Aug 2, 2016):

The fields I listed above are just the new additions. Serial has always been included in device search (also the serials of installed modules):

    def search(self, queryset, value):
        return queryset.filter(
            Q(name__icontains=value) |
            Q(serial__icontains=value) |
            Q(modules__serial__icontains=value) |
            Q(comments__icontains=value)
        ).distinct()
@jeremystretch commented on GitHub (Aug 2, 2016): The fields I listed above are just the new additions. Serial has always been included in device search (also the serials of installed modules): ``` def search(self, queryset, value): return queryset.filter( Q(name__icontains=value) | Q(serial__icontains=value) | Q(modules__serial__icontains=value) | Q(comments__icontains=value) ).distinct() ```
Author
Owner

@wzyboy commented on GitHub (Aug 3, 2016):

Yes, I know I can generally search for foo and all devices with foo values would be returned in JSON. However, if device A has string foo in comments field and device B has string foo in serial field. Device A and B would both be returned when searching for foo. We had to manually check if foo appears in serial field. It would be nice if we can just search for foo in serial field.

@wzyboy commented on GitHub (Aug 3, 2016): Yes, I know I can generally search for `foo` and all devices with `foo` values would be returned in JSON. However, if device A has string `foo` in `comments` field and device B has string `foo` in `serial` field. Device A and B would both be returned when searching for `foo`. We had to manually check if `foo` appears in `serial` field. It would be nice if we can just search for `foo` in `serial` field.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#267