Skip to content

Commit c8291f4

Browse files
authored
Merge pull request #208 from algoliareadmebot/master
Update README
2 parents f4ffaeb + 24a4abd commit c8291f4

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ This package lets you easily integrate the Algolia Search API to your [Django](h
1111

1212
You might be interested in this sample Django application providing a typeahead.js based auto-completion and Google-like instant search: [algoliasearch-django-example](https://github.com/algolia/algoliasearch-django-example)
1313

14+
Compatible with **Python 2.7**, **Python 3.3+** and **Django 1.7+**
15+
1416

1517

1618

@@ -70,7 +72,7 @@ pip install algoliasearch-django
7072

7173
## Setup
7274

73-
In your Django settings, add `algoliasearch_django` to `INSTALLED_APPS` and add these two settings:
75+
In your Django settings, add `django.contrib.algoliasearch` to `INSTALLED_APPS` and add these two settings:
7476

7577
```python
7678
ALGOLIA = {
@@ -91,14 +93,14 @@ Simply call `algoliasearch.register()` for each of the models you want to index.
9193

9294
```python
9395
from django.apps import AppConfig
94-
from algoliasearch_django import register
96+
from django.contrib import algoliasearch
9597

9698
class YourAppConfig(AppConfig):
9799
name = 'your_app'
98100

99101
def ready(self):
100102
YourModel = self.get_model('your_model')
101-
register(YourModel)
103+
algoliasearch.register(YourModel)
102104
```
103105

104106
And then, don't forget the line below in the `__init__.py` file of your Django application.
@@ -110,7 +112,7 @@ default_app_config = 'your_django_app.apps.YourAppConfig'
110112
By default, all the fields of your model will be used. You can configure the index by creating a subclass of `AlgoliaIndex`. A good place to do this is in a separate file, like `index.py`.
111113

112114
```python
113-
from algoliasearch_django import AlgoliaIndex
115+
from django.contrib.algoliasearch import AlgoliaIndex
114116

115117
class YourModelIndex(AlgoliaIndex):
116118
fields = ('name', 'date')
@@ -119,7 +121,7 @@ class YourModelIndex(AlgoliaIndex):
119121
index_name = 'my_index'
120122
```
121123

122-
And then replace `register(YourModel)` with `register(YourModel, YourModelIndex)`.
124+
And then replace `algoliasearch.register(YourModel)` with `algoliasearch.register(YourModel, YourModelIndex)`.
123125

124126

125127
# Commands
@@ -145,7 +147,7 @@ We recommend the usage of our [JavaScript API Client](https://github.com/algolia
145147
However, if you want to search from your backend you can use the `raw_search(YourModel, 'yourQuery', params)` method. It retrieves the raw JSON answer from the API.
146148

147149
```python
148-
from algoliasearch_django import raw_search
150+
from django.contrib.algoliasearch import raw_search
149151

150152
params = { "hitsPerPage": 5 }
151153
raw_search(Contact, "jim", params)
@@ -212,7 +214,7 @@ You can customize the index name. By default, the index name will be the name of
212214

213215
```python
214216
class ContactIndex(algoliaindex):
215-
index_name = 'MyIndexName'
217+
index_name = 'Enterprise'
216218
```
217219

218220
## Index settings

0 commit comments

Comments
 (0)