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

Expand search to description and comment fields #358

Closed
JosephRPalmer opened this issue Jul 21, 2016 · 9 comments
Closed

Expand search to description and comment fields #358

JosephRPalmer opened this issue Jul 21, 2016 · 9 comments
Labels
type: feature Introduction of new functionality to the application

Comments

@JosephRPalmer
Copy link

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

@ryanmerolle
Copy link
Contributor

This probably ties int #166

@farewelldave
Copy link

Yes, this would be great!

@jeremystretch jeremystretch added the type: feature Introduction of new functionality to the application label Jul 22, 2016
@malaiam
Copy link

malaiam commented 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.

@jeremystretch jeremystretch changed the title Make IPs searchable by description Expand search to description and comment fields Jul 29, 2016
@jeremystretch
Copy link
Member

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

@jeremystretch
Copy link
Member

38aee33 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

@wzyboy
Copy link

wzyboy commented 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
Copy link

wzyboy commented Aug 2, 2016

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

@jeremystretch
Copy link
Member

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()

@wzyboy
Copy link

wzyboy commented 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.

if-fi pushed a commit to if-fi/netbox that referenced this issue Oct 1, 2016
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

6 participants