From ecf5304a148a2301e38d41fb396a12c4c1224542 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Tue, 15 Nov 2022 10:37:35 -0500 Subject: [PATCH] #10560: Add new fields to indexers --- netbox/circuits/search.py | 1 + netbox/dcim/search.py | 30 +++++++++++++++++++++++++++--- netbox/ipam/search.py | 20 ++++++++++++++++++++ netbox/tenancy/search.py | 1 + netbox/virtualization/search.py | 2 ++ netbox/wireless/search.py | 2 ++ 6 files changed, 53 insertions(+), 3 deletions(-) diff --git a/netbox/circuits/search.py b/netbox/circuits/search.py index 673f6308f..2859295d5 100644 --- a/netbox/circuits/search.py +++ b/netbox/circuits/search.py @@ -40,6 +40,7 @@ class ProviderIndex(SearchIndex): fields = ( ('name', 100), ('account', 200), + ('description', 500), ('comments', 5000), ) diff --git a/netbox/dcim/search.py b/netbox/dcim/search.py index d34a78888..bae4f030f 100644 --- a/netbox/dcim/search.py +++ b/netbox/dcim/search.py @@ -7,6 +7,8 @@ class CableIndex(SearchIndex): model = models.Cable fields = ( ('label', 100), + ('description', 500), + ('comments', 5000), ) @@ -39,6 +41,7 @@ class DeviceIndex(SearchIndex): ('asset_tag', 50), ('serial', 60), ('name', 100), + ('description', 500), ('comments', 5000), ) @@ -69,6 +72,7 @@ class DeviceTypeIndex(SearchIndex): fields = ( ('model', 100), ('part_number', 200), + ('description', 500), ('comments', 5000), ) @@ -136,6 +140,7 @@ class ModuleIndex(SearchIndex): fields = ( ('asset_tag', 50), ('serial', 60), + ('description', 500), ('comments', 5000), ) @@ -156,6 +161,7 @@ class ModuleTypeIndex(SearchIndex): fields = ( ('model', 100), ('part_number', 200), + ('description', 500), ('comments', 5000), ) @@ -176,6 +182,7 @@ class PowerFeedIndex(SearchIndex): model = models.PowerFeed fields = ( ('name', 100), + ('description', 500), ('comments', 5000), ) @@ -195,6 +202,8 @@ class PowerPanelIndex(SearchIndex): model = models.PowerPanel fields = ( ('name', 100), + ('description', 500), + ('comments', 5000), ) @@ -218,6 +227,7 @@ class RackIndex(SearchIndex): ('serial', 60), ('name', 100), ('facility_id', 200), + ('description', 500), ('comments', 5000), ) @@ -227,6 +237,7 @@ class RackReservationIndex(SearchIndex): model = models.RackReservation fields = ( ('description', 500), + ('comments', 5000), ) @@ -256,7 +267,7 @@ class RegionIndex(SearchIndex): fields = ( ('name', 100), ('slug', 110), - ('description', 500) + ('description', 500), ) @@ -280,7 +291,7 @@ class SiteGroupIndex(SearchIndex): fields = ( ('name', 100), ('slug', 110), - ('description', 500) + ('description', 500), ) @@ -289,5 +300,18 @@ class VirtualChassisIndex(SearchIndex): model = models.VirtualChassis fields = ( ('name', 100), - ('domain', 300) + ('domain', 300), + ('description', 500), + ('comments', 5000), + ) + + +@register_search +class VirtualDeviceContextIndex(SearchIndex): + model = models.VirtualDeviceContext + fields = ( + ('name', 100), + ('identifier', 300), + ('description', 500), + ('comments', 5000), ) diff --git a/netbox/ipam/search.py b/netbox/ipam/search.py index d1d25da76..fd6db6a63 100644 --- a/netbox/ipam/search.py +++ b/netbox/ipam/search.py @@ -9,6 +9,7 @@ class AggregateIndex(SearchIndex): ('prefix', 100), ('description', 500), ('date_added', 2000), + ('comments', 5000), ) @@ -28,6 +29,7 @@ class FHRPGroupIndex(SearchIndex): ('name', 100), ('group_id', 2000), ('description', 500), + ('comments', 5000), ) @@ -38,6 +40,7 @@ class IPAddressIndex(SearchIndex): ('address', 100), ('dns_name', 300), ('description', 500), + ('comments', 5000), ) @@ -48,6 +51,7 @@ class IPRangeIndex(SearchIndex): ('start_address', 100), ('end_address', 300), ('description', 500), + ('comments', 5000), ) @@ -58,6 +62,7 @@ class L2VPNIndex(SearchIndex): ('name', 100), ('slug', 110), ('description', 500), + ('comments', 5000), ) @@ -67,6 +72,7 @@ class PrefixIndex(SearchIndex): fields = ( ('prefix', 100), ('description', 500), + ('comments', 5000), ) @@ -96,6 +102,7 @@ class RouteTargetIndex(SearchIndex): fields = ( ('name', 100), ('description', 500), + ('comments', 5000), ) @@ -105,6 +112,17 @@ class ServiceIndex(SearchIndex): fields = ( ('name', 100), ('description', 500), + ('comments', 5000), + ) + + +@register_search +class ServiceTemplateIndex(SearchIndex): + model = models.ServiceTemplate + fields = ( + ('name', 100), + ('description', 500), + ('comments', 5000), ) @@ -115,6 +133,7 @@ class VLANIndex(SearchIndex): ('name', 100), ('vid', 100), ('description', 500), + ('comments', 5000), ) @@ -136,4 +155,5 @@ class VRFIndex(SearchIndex): ('name', 100), ('rd', 200), ('description', 500), + ('comments', 5000), ) diff --git a/netbox/tenancy/search.py b/netbox/tenancy/search.py index 8cb3c4ccb..bee497608 100644 --- a/netbox/tenancy/search.py +++ b/netbox/tenancy/search.py @@ -12,6 +12,7 @@ class ContactIndex(SearchIndex): ('email', 300), ('address', 300), ('link', 300), + ('description', 500), ('comments', 5000), ) diff --git a/netbox/virtualization/search.py b/netbox/virtualization/search.py index 184bf7049..aef3425f0 100644 --- a/netbox/virtualization/search.py +++ b/netbox/virtualization/search.py @@ -7,6 +7,7 @@ class ClusterIndex(SearchIndex): model = models.Cluster fields = ( ('name', 100), + ('description', 500), ('comments', 5000), ) @@ -36,6 +37,7 @@ class VirtualMachineIndex(SearchIndex): model = models.VirtualMachine fields = ( ('name', 100), + ('description', 500), ('comments', 5000), ) diff --git a/netbox/wireless/search.py b/netbox/wireless/search.py index 55ca2977c..1f8097cd7 100644 --- a/netbox/wireless/search.py +++ b/netbox/wireless/search.py @@ -9,6 +9,7 @@ class WirelessLANIndex(SearchIndex): ('ssid', 100), ('description', 500), ('auth_psk', 2000), + ('comments', 5000), ) @@ -29,4 +30,5 @@ class WirelessLinkIndex(SearchIndex): ('ssid', 100), ('description', 500), ('auth_psk', 2000), + ('comments', 5000), )