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
Copy file name to clipboardExpand all lines: README.md
+27-16Lines changed: 27 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,44 +98,55 @@ We recommend the usage of our [JavaScript API Client](https://github.com/algolia
98
98
99
99
## Geo-Search
100
100
101
-
Use the `geo_field` attribute to localize your record. `geo_field`can be a tuple or a callable that return a tuple (latitude, longitude).
101
+
Use the `geo_field` attribute to localize your record. `geo_field`should be a callable that returns a tuple (latitude, longitude).
102
102
103
103
```python
104
-
classContact(models.Model):
105
-
name = models.CharField()
106
-
lat = models.FloatField()
107
-
lng = models.FloatField()
104
+
classcontact(models.model):
105
+
name = models.charfield()
106
+
lat = models.floatfield()
107
+
lng = models.floatfield()
108
108
109
109
deflocation(self):
110
110
return (self.lat, self.lng)
111
111
112
112
113
-
classContactIndex(AlgoliaIndex):
113
+
classcontactindex(algoliaindex):
114
114
fields ='name'
115
115
geo_field ='location'
116
116
117
117
118
-
algoliasearch.register(Contact, ContactIndex)
118
+
algoliasearch.register(contact, contactindex)
119
119
```
120
120
121
-
# Options
121
+
# Tags
122
122
123
-
## Custom `objectID`
124
-
125
-
You can choose which field will be used as the `objectID`. The field should be unique and can be a string or integer. By default, we use the `pk` field of the model.
123
+
Use the `tags` attributes to add tags to your record. It can be a field or a callable.
126
124
127
125
```python
128
126
classArticleIndex(AlgoliaIndex):
129
-
custom_objectID ='post_id'
127
+
tags ='category'
128
+
```
129
+
130
+
At query time, specify `{ tagFilters: 'tagvalue' }` or `{ tagFilters: ['tagvalue1', 'tagvalue2'] }` as search parameters to restrict the result set to specific tags.
131
+
132
+
# options
133
+
134
+
## custom `objectid`
135
+
136
+
you can choose which field will be used as the `objectid`. the field should be unique and can be a string or integer. by default, we use the `pk` field of the model.
137
+
138
+
```python
139
+
classarticleindex(algoliaindex):
140
+
custom_objectid ='post_id'
130
141
```
131
142
132
-
## Custom index name
143
+
## custom index name
133
144
134
-
You can customize the inde name. By default, the index name will be the name of the model class.
145
+
You can customize the index name. By default, the index name will be the name of the model class.
0 commit comments