django-haystack をセットアップしていますが、質問があります。
私はdjango-profilesを使用しています。これにより、都市、性別などの個別の情報を追加できます。
search_indexes.py
検索を実行すると、UserProfile
ユーザーのユーザー名の結果のみが返されるように見えます。
入力john
してユーザーのユーザー名が john の場合、それが取得されます。入力James
してユーザーjohn
の名がJames
である場合、結果は返されません。
私のsearch_indexes.py
from haystack.indexes import *
from haystack import site
from models import UserProfile
class UserProfileIndex(SearchIndex):
text = CharField(document=True, use_template=True)
user = CharField(model_attr='user', use_template=True)
def prepare_user(self, obj):
return "%s <%s>" % (obj.user.get_full_name(), obj.user.email)
site.register(UserProfile, UserProfileIndex)