干草堆搜索多值字段

时间:2014-12-23 17:06:38

标签: django solr django-haystack

我正在尝试搜索多值字段。

搜索索引:

class UserIndex(indexes.SearchIndex, indexes.Indexable):
    text = indexes.CharField(document=True, use_template=True)
    user_name = indexes.CharField(model_attr='first_name',null=True)
    education_institute = indexes.MultiValueField(null=True)

    def prepare_education_institute(self, obj):
        return [education.institute for education in obj.educations.all()]

在用户名上搜索工作正常但我在搜索education_institute时没有得到任何结果。

user_text.txt:

{{ object.first_name }}
{% for education in object.education_institute %}
{{ education }}
{% endfor %}

我尝试过很多东西但是没有用过。 任何帮助将受到高度赞赏。感谢

0 个答案:

没有答案
相关问题