I have a model with CharField()
class MyModel(models.Model)
field = models.CharField(...)
How can I configure Haystack to index first letter of this field in SearchIndex?
class MyIndex(SearchIndex):
starts_with = CharFiled(?)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I found out that Haystack has something like Django`s forms clean functions which is called prepare.
So in my case to get first letter from field I can do:
class MyIndex(SearchIndex):
starts_with = CharField()