Global search on homepage #121

Closed
opened 2025-12-29 15:33:56 +01:00 by adam · 14 comments
Owner

Originally created by @ghost on GitHub (Jul 1, 2016).

A search across all sections and all fields. e.g. search for "customerX" and the results page shows Racks, Devices, Circuits etc. that contain any matched field content.

Originally created by @ghost on GitHub (Jul 1, 2016). A search across all sections and all fields. e.g. search for "customerX" and the results page shows Racks, Devices, Circuits etc. that contain any matched field content.
adam closed this issue 2025-12-29 15:33:56 +01:00
Author
Owner

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

This looks like it relates to #132.

@ryanmerolle commented on GitHub (Jul 1, 2016): This looks like it relates to #132.
Author
Owner

@ghost commented on GitHub (Jul 1, 2016):

#132 specifically mentions 'devices', but if that can be expanded to ALL sections, then yes.

@ghost commented on GitHub (Jul 1, 2016): #132 specifically mentions 'devices', but if that can be expanded to ALL sections, then yes.
Author
Owner

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

@paradoxni In your example you use a customer name. I think that specific function would be provided by #16 (multitenancy support).

@jeremystretch commented on GitHub (Jul 1, 2016): @paradoxni In your example you use a customer name. I think that specific function would be provided by #16 (multitenancy support).
Author
Owner

@ghost commented on GitHub (Jul 1, 2016):

I had used the search term as an example, but I think it would be useful to be able to search across all fields (including comments) across all sections. Another example would be a circuit, where you could search not just using circuitID. A global search, if you will.

@ghost commented on GitHub (Jul 1, 2016): I had used the search term as an example, but I think it would be useful to be able to search across all fields (including comments) across all sections. Another example would be a circuit, where you could search not just using circuitID. A global search, if you will.
Author
Owner

@rekeds commented on GitHub (Jul 6, 2016):

imported stuff from phpIPAM, "Search Within" doesn't search the "Description" field?

@rekeds commented on GitHub (Jul 6, 2016): imported stuff from phpIPAM, "Search Within" doesn't search the "Description" field?
Author
Owner

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

@rekeds "Search within" limits searches to a scope. For example, finding all prefixes within 192.168.0.0/16.

@jeremystretch commented on GitHub (Jul 6, 2016): @rekeds "Search within" limits searches to a scope. For example, finding all prefixes within 192.168.0.0/16.
Author
Owner

@rekeds commented on GitHub (Jul 7, 2016):

@jeremystretch thank you. Netbox is great.
+1 for ability to search "all fields".

@rekeds commented on GitHub (Jul 7, 2016): @jeremystretch thank you. Netbox is great. +1 for ability to search "all fields".
Author
Owner

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

I would want to see this global search field on every page, not just the homepage. I don't see a problem with contextual search as well, but like having a lazy global search too. Hopefully this includes all types of fields, as addressed in https://github.com/digitalocean/netbox/issues/358

@alexjhart commented on GitHub (Jul 29, 2016): I would want to see this global search field on every page, not just the homepage. I don't see a problem with contextual search as well, but like having a lazy global search too. Hopefully this includes all types of fields, as addressed in https://github.com/digitalocean/netbox/issues/358
Author
Owner

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

#358 was merely an expansion to the existing direct database querying. Implementing global search will require a dedicated search engine and indexing e.g. using Haystack.

@jeremystretch commented on GitHub (Jul 29, 2016): #358 was merely an expansion to the existing direct database querying. Implementing global search will require a dedicated search engine and indexing e.g. using [Haystack](http://haystacksearch.org/).
Author
Owner

@hawko2600 commented on GitHub (Dec 16, 2016):

Adding an enterprise search engine seems a bit overkill for simply federating search across the existing models. Since we're tied to PostgreSQL anyway, you should be able to use

https://docs.djangoproject.com/en/1.10/_modules/django/contrib/postgres/search/#SearchVector

to pull results across all the models.

@hawko2600 commented on GitHub (Dec 16, 2016): Adding an enterprise search engine seems a bit overkill for simply federating search across the existing models. Since we're tied to PostgreSQL anyway, you should be able to use https://docs.djangoproject.com/en/1.10/_modules/django/contrib/postgres/search/#SearchVector to pull results across all the models.
Author
Owner

@jeremystretch commented on GitHub (Dec 16, 2016):

@darthmdh I could be missing something but I think that's still limited to searching one table (model) at a time. What we want is to search for an instance of a string across many models.

@jeremystretch commented on GitHub (Dec 16, 2016): @darthmdh I could be missing something but I think that's still limited to searching one table (model) at a time. What we want is to search for an instance of a string across many models.
Author
Owner

@hawko2600 commented on GitHub (Dec 22, 2016):

@jeremystretch The docs claim you can combine SearchVectors with + syntax but looking at the examples its unclear to me if that then makes logical sense when it comes to filter() the results. Unfortunately other than for deployment purposes I haven't yet dived into Django 1.10 to get familiar with this new API.

Maybe something like https://github.com/etianen/django-watson is more immediately useful?

@hawko2600 commented on GitHub (Dec 22, 2016): @jeremystretch The docs claim you can combine SearchVectors with + syntax but looking at the examples its unclear to me if that then makes logical sense when it comes to filter() the results. Unfortunately other than for deployment purposes I haven't yet dived into Django 1.10 to get familiar with this new API. Maybe something like https://github.com/etianen/django-watson is more immediately useful?
Author
Owner

@candlerb commented on GitHub (Feb 6, 2017):

Or, to state the obvious:

    devices = Device.objects.filter(Q(name__icontains=q) | Q(comments__icontains=q) |
                                    Q(serial__icontains=q) | Q(asset_tag__icontains=q) | ... )
    prefixes = Prefix.objects.filter(...)
    addresses = IPAddress.objects.filter(...)
    # etc

The results page has a subsection for devices, a subsection for prefixes, a subsection for addresses etc. Each section is skipped if there are no matches. Each section can be limited to (say) 10 hits, and if you hit the More... link then it does a regular search for that object type only.

If the query looks like an IP address then parse it as such, and add the relevant IP address field searches.

@candlerb commented on GitHub (Feb 6, 2017): Or, to state the obvious: ~~~ devices = Device.objects.filter(Q(name__icontains=q) | Q(comments__icontains=q) | Q(serial__icontains=q) | Q(asset_tag__icontains=q) | ... ) prefixes = Prefix.objects.filter(...) addresses = IPAddress.objects.filter(...) # etc ~~~ The results page has a subsection for devices, a subsection for prefixes, a subsection for addresses etc. Each section is skipped if there are no matches. Each section can be limited to (say) 10 hits, and if you hit the More... link then it does a regular search for that object type only. If the query looks like an IP address then parse it as such, and add the relevant IP address field searches.
Author
Owner

@jeremystretch commented on GitHub (Mar 29, 2017):

This has been implemented on the v2-develop branch and will be available in NetBox v2.0.

@jeremystretch commented on GitHub (Mar 29, 2017): This has been implemented on the `v2-develop` branch and will be available in NetBox v2.0.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#121