You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This allows the ManyToMany field accounts to be saved as a JSON serializable searchable attribute in our Algolia index as account_names.
Is there a way to transform accounts so that it is transformed to have the same value as account_names while keeping the original name.
The use case is that my Django server exposes a REST API using the Django Rest Framework which also serializes the ManyToManyField and is consumed by my frontend client which uses the original name (e.g. accounts). I don't want to maintain 2 sets of field names.
I'm envisioning something like a field_mappings attribute:
fromalgoliasearch_djangoimportAlgoliaIndexclassContactIndex(AlgoliaIndex):
fields= ('name', 'email', 'account_names', 'account_ids')
settings= {
'searchableAttributes': ['name', 'email', 'account_names']
}
field_mappings= { 'account_names': 'accounts'} #<--- This is the new line
The Algolia Field Preprocessing example says that we can define a custom method if we want to preproces a field.
Similar issue: #2
This allows the ManyToMany field
accounts
to be saved as a JSON serializable searchable attribute in our Algolia index asaccount_names
.Is there a way to transform
accounts
so that it is transformed to have the same value asaccount_names
while keeping the original name.The use case is that my Django server exposes a REST API using the Django Rest Framework which also serializes the ManyToManyField and is consumed by my frontend client which uses the original name (e.g.
accounts
). I don't want to maintain 2 sets of field names.I'm envisioning something like a
field_mappings
attribute:The text was updated successfully, but these errors were encountered: