1
정렬 그래서처럼 사용자 프로필 검색 인덱스가 :장고 건초 더미와 붕 : 없음 열 예외
class UserProfileIndex(SearchIndex, Indexable):
text = CharField(document=True, use_template=True)
last_name = CharField(model_attr='last_name', indexed=True)
country = CharField(model_attr='country')
sectors = CharField(use_template=True)
services = CharField(use_template=True)
def get_model(self):
return UserProfile
def index_queryset(self, using=None):
"""
Used when the entire index for model is updated."""
return self.get_model().public.all()
내가이 명령을 사용하여 LAST_NAME 필드를 기준으로 정렬하는 것을 시도하고있다 :
s = SearchQuerySet().all().order_by('last_name')
을
그 다음 돌아왔다 :
Exception: No column for field 'last_name'
나는 그 들판에서 필터를하는 데 아무런 문제가 없다.
s = SearchQuerySet().filter(last_name='Smith')
잘 작동합니다.
나는 이것이 호슈 문제라고 생각하지만, 해결 방법을 찾을 수없는 것 같습니다.
감사합니다. 그것은 이상한 요구 사항입니다. 특히 제가 작업중인 프로젝트에서 약 15 개의 다른 인덱스가있는 경우 특히 그렇습니다. 대신 Whoosh에서 이동하여 Elastic Search로 전환하여 백엔드로 사용했습니다. 이런 유형의 문제가 적다. 내가 찾은 다른 하나는 Whoosh가 .model () 구문을 사용하도록하지 않으므로 대신 필터 (django_ct = '')를 사용해야합니다. –
이것을 발견하고 방금 프로젝트를 마쳤을 때 Elastic Search로 전환하려고했습니다. 예쁜 기본 쿼리를 통해 Whoosh의 한계에 매우 빨리 부딪쳤습니다. 나는 .model 제한에 맞서 도망 갈 것이다. 프로젝트를 더 연장한다면 계속하기 전에 거의 확실하게 전환 할 것입니다. – pbaehr