@@ -30,15 +30,15 @@ look like::
3030    HAYSTACK_SOLR_TIMEOUT = 60 * 5 
3131    HAYSTACK_INCLUDE_SPELLING = True 
3232    HAYSTACK_BATCH_SIZE = 100 
33-      
33+ 
3434    # Or... 
3535    HAYSTACK_SEARCH_ENGINE = 'whoosh' 
3636    HAYSTACK_WHOOSH_PATH = '/home/search/whoosh_index' 
3737    HAYSTACK_WHOOSH_STORAGE = 'file' 
3838    HAYSTACK_WHOOSH_POST_LIMIT = 128 * 1024 * 1024 
3939    HAYSTACK_INCLUDE_SPELLING = True 
4040    HAYSTACK_BATCH_SIZE = 100 
41-      
41+ 
4242    # Or... 
4343    HAYSTACK_SEARCH_ENGINE = 'xapian' 
4444    HAYSTACK_XAPIAN_PATH = '/home/search/xapian_index' 
@@ -125,35 +125,35 @@ A Haystack 1.X index might've looked like::
125125    from haystack.indexes import * 
126126    from haystack import site 
127127    from myapp.models import Note 
128-      
129-      
128+ 
129+ 
130130    class NoteIndex(SearchIndex): 
131131        text = CharField(document=True, use_template=True) 
132132        author = CharField(model_attr='user') 
133133        pub_date = DateTimeField(model_attr='pub_date') 
134-          
134+ 
135135        def get_queryset(self): 
136136            """Used when the entire index for model is updated.""" 
137137            return Note.objects.filter(pub_date__lte=datetime.datetime.now()) 
138-      
139-      
138+ 
139+ 
140140    site.register(Note, NoteIndex) 
141141
142142A converted Haystack 2.X index should look like::
143143
144144    import datetime 
145145    from haystack import indexes 
146146    from myapp.models import Note 
147-      
148-      
147+ 
148+ 
149149    class NoteIndex(indexes.SearchIndex, indexes.Indexable): 
150150        text = indexes.CharField(document=True, use_template=True) 
151151        author = indexes.CharField(model_attr='user') 
152152        pub_date = indexes.DateTimeField(model_attr='pub_date') 
153-          
153+ 
154154        def get_model(self): 
155155            return Note 
156-          
156+ 
157157        def index_queryset(self): 
158158            """Used when the entire index for model is updated.""" 
159159            return self.get_model().objects.filter(pub_date__lte=datetime.datetime.now()) 
@@ -180,15 +180,21 @@ method. This was present in the Haystack 1.2.X series (with a deprecation warnin
180180in 1.2.4+) but has been removed in Haystack v2.
181181
182182Finally, if you were unregistering other indexes before, you should make use of
183- the new ``HAYSTACK_EXCLUDED_INDEXES `` setting. It should be a list of strings 
184- that contain the Python import path to the indexes that should not be loaded & 
185- used. For example::
183+ the new ``EXCLUDED_INDEXES `` setting available in each backend's settings. It 
184+ should be a list of strings  that contain the Python import path to the indexes
185+ that should not be loaded &  used. For example::
186186
187-     HAYSTACK_EXCLUDED_INDEXES = [ 
188-         # Imagine that these indexes exist. They don't. 
189-         'django.contrib.auth.search_indexes.UserIndex', 
190-         'third_party_blog_app.search_indexes.EntryIndex', 
191-     ] 
187+     HAYSTACK_CONNECTIONS = { 
188+         'default': { 
189+             'ENGINE': 'haystack.backends.solr_backend.SolrEngine', 
190+             'URL': 'http://localhost:9001/solr/default', 
191+             'EXCLUDED_INDEXES': [ 
192+                 # Imagine that these indexes exist. They don't. 
193+                 'django.contrib.auth.search_indexes.UserIndex', 
194+                 'third_party_blog_app.search_indexes.EntryIndex', 
195+             ] 
196+         } 
197+     } 
192198
193199This allows for reliable swapping of the index that handles a model without
194200relying on correct import order.
@@ -239,9 +245,9 @@ that the classes are defined above it) and should look like::
239245
240246    from haystack.backends import BaseEngine 
241247    from haystack.backends.solr_backend import SolrSearchQuery 
242-      
248+ 
243249    # Code then... 
244-      
250+ 
245251    class MyCustomSolrEngine(BaseEngine): 
246252        # Use our custom backend. 
247253        backend = MySolrBackend 
0 commit comments