소스 검색

feat(search): Add search index for tags

Introduces a search index for the Tag model to enable global search for
Tags. Includes fields for name, slug, and description with corresponding
weight values. Display attributes are limited to the description field.

Fixes #17073
Martin Hauser 9 달 전
부모
커밋
127452f4d5
1개의 변경된 파일11개의 추가작업 그리고 0개의 파일을 삭제
  1. 11 0
      netbox/extras/search.py

+ 11 - 0
netbox/extras/search.py

@@ -24,6 +24,17 @@ class JournalEntryIndex(SearchIndex):
     display_attrs = ('kind', 'created_by')
 
 
+@register_search
+class TagIndex(SearchIndex):
+    model = models.Tag
+    fields = (
+        ('name', 100),
+        ('slug', 110),
+        ('description', 500),
+    )
+    display_attrs = ('description',)
+
+
 @register_search
 class WebhookEntryIndex(SearchIndex):
     model = models.Webhook