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
+14-11Lines changed: 14 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
+
<!--NO_HTML-->
1
2
Algolia Search for Django
2
3
==================
4
+
<!--/NO_HTML-->
3
5
4
6
This package lets you easily integrate the Algolia Search API to your [Django](https://www.djangoproject.com/) project. It's based on the [algoliasearch-client-python](https://github.com/algolia/algoliasearch-client-python) package.
5
7
@@ -11,6 +13,7 @@ Compatible with **Python 2.7**, **Python 3.2+** and **Django 1.7+**
In your Django settings, add `django.contrib.algoliasearch` to `INSTALLED_APPS` and add these two settings:
40
42
@@ -51,8 +53,8 @@ There are two optional settings:
51
53
*`INDEX_SUFFIX`: suffix all indexes. Use it to differenciate development and production environment, like `Location_dev` and `Location_prod`.
52
54
*`AUTO_INDEXING`: automatically synchronize the models with Algolia (default to **True**).
53
55
54
-
Quick Start
55
-
-------------
56
+
57
+
# Quick Start
56
58
57
59
Simply call `AlgoliaSearch.register()` for each of the models you want to index. A good place to do this is in your application's AppConfig (generally named `apps.py`). More info in the [documentation](https://docs.djangoproject.com/en/1.8/ref/applications/)
58
60
@@ -88,13 +90,13 @@ class YourModelIndex(AlgoliaIndex):
88
90
89
91
And then replace `algoliasearch.register(YourModel)` with `algoliasearch.register(YourModel, YourModelIndex)`.
90
92
91
-
##Commands
93
+
# Commands
92
94
93
95
*`python manage.py algolia_reindex`: reindex all the registered models. This command will first send all the record to a temporary index and then moves it.
94
96
*`python manage.py algolia_applysettings`: (re)apply the index settings.
95
97
*`python manage.py algolia_clearindex`: clear the index
96
98
97
-
##Search
99
+
# Search
98
100
99
101
We recommend the usage of our [JavaScript API Client](https://github.com/algolia/algoliasearch-client-js) to perform queries directly from the end-user browser without going through your server.
100
102
@@ -107,7 +109,7 @@ params = { "hitsPerPage": 5 }
107
109
raw_search(Contact, "jim", params)
108
110
```
109
111
110
-
##Geo-Search
112
+
# Geo-Search
111
113
112
114
Use the `geo_field` attribute to localize your record. `geo_field` should be a callable that returns a tuple (latitude, longitude).
113
115
@@ -188,11 +190,12 @@ class ContactIndex(AlgoliaIndex):
188
190
should_index ='is_adult'
189
191
```
190
192
191
-
Run Tests
192
-
-------------
193
+
<!--NO_HTML-->
194
+
# Run Tests
193
195
194
196
To run the tests, first find your Algolia application id and Admin API key (found on the Credentials page).
0 commit comments