Enable caching of object attributes in search index #9350

Closed
opened 2025-12-29 20:48:53 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Mar 12, 2024).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.7.3

Feature type

New functionality

Proposed functionality

Extend SearchIndex to enable caching object attributes in addition to concrete model fields. This can be achieved by tweaking its get_field_type() method to also accept attributes. (get_field_value() probably doesn't need modification as it's simply wrapping getattr().)

Use case

This will enable NetBox to capture rendered attributes in addition to raw database values. For instance, #14201 requests caching the number of an ASN object as the string "AS1234" in addition to the plain numeric value.

Database changes

None expected

External dependencies

None

Originally created by @jeremystretch on GitHub (Mar 12, 2024). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.7.3 ### Feature type New functionality ### Proposed functionality Extend `SearchIndex` to enable caching object attributes in addition to concrete model fields. This can be achieved by tweaking its `get_field_type()` method to also accept attributes. (`get_field_value()` probably doesn't need modification as it's simply wrapping `getattr()`.) ### Use case This will enable NetBox to capture rendered attributes in addition to raw database values. For instance, #14201 requests caching the number of an ASN object as the string "AS1234" in addition to the plain numeric value. ### Database changes None expected ### External dependencies None
adam added the status: acceptedtype: feature labels 2025-12-29 20:48:53 +01:00
adam closed this issue 2025-12-29 20:48:54 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9350