Вопрос

Context:
SearchIndex is analogous to django's Model. It is even tied to a single model via get_model.
SearchQuerySet is analogous to django's QuerySet (except the way of obtaining an instance).
HAYSTACK_CONNECTIONS are analogous to django's DATABASES.

One not immediately apparent difference is that performing SearchQuerySet operations uses ALL SearchIndex subclasses you have.
How to perform operations on a single SearchIndex (for a single model) only? Connections don't seem to be meant for this.

Это было полезно?

Решение

SearchQuerySet.models is the answer, buried deep in the docs.
Add .models(DjangoModel1, DjangoModel2) to your SearchQuerySet calls, where the models are those returned by your chosen SearchIndexes' get_model.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top