나는 요리법 전문을 검색하려고합니다. 재료를 문서 필드로 지정했습니다. 모든 것이 잘 작동하지만 검색 결과에 좀 더 많은 제약을 가하고 싶습니다.덤불 결과 필터링
예를 들어 필드 재료에 대한 전체 텍스트 검색을 수행하려고하지만 지정된 카테고리와 일치하는 모델 만 검색하도록합니다.
문서를 검토했지만 설정해야 할 쿼리 매개 변수를 찾지 못했거나 색인에 대한 변경 사항을 찾지 못했습니다.
나는 중요 색인 인 경우 색인 생성을 위해 elasticsearch를 사용하고 있습니다.
class ArticleIndex(indexes.SearchIndex,indexes.Indexable):
text = indexes.CharField(document=True,model_attr='ingredients')
title = indexes.CharField(model_attr='title')
category = indexes.CharField(model_attr='category')
image_link = indexes.CharField(model_attr='image_link')
publication_date = indexes.DateTimeField(model_attr='publication_date')
def get_model(self):
return Article
검색 요청을 처리하는보기를 제공 할 수 있습니까? 나는 당신이'SearchQuerySet'을 왜 이렇게 좁힐 수 없는지 알 수 없다.'sqs.filter (category__exact = self.cleaned_data [ 'user_provided_category])' – trixn