문제

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