Джанго Стог docs say:Основное название поля (документ = True)
**Warning**
When you choose a document=True field, it should be consistently named across all of your SearchIndex classes to avoid confusing the backend. The convention is to name this field text.
There is nothing special about the text field name used in all of the examples. It could be anything; you could call it pink_polka_dot and it won’t matter. It’s simply a convention to call it text.
Но я не понимаю, что это значит. Это их пример модель:
импорт DateTime из Стога импорта индексов из myapp.models импорта Примечания
class NoteIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
author = indexes.CharField(model_attr='user')
pub_date = indexes.DateTimeField(model_attr='pub_date')
def get_model(self):
return Note
def index_queryset(self, using=None):
"""Used when the entire index for model is updated."""
return self.get_model().objects.filter(pub_date__lte=datetime.datetime.now())
текст, который я цитировал ссылаясь на мою модели основного поле и сказать, что я должен назвать это «текст "или к классу, определенному в search_indexes.py?
Если класс в search_indexes.py, где имя поля, к которому он присоединен в примере выше? У него нет model_attr!
text = indexes.CharField(document=True, use_template=True)
А если мои фактические модели приложения, как я ожидал, чтобы реорганизовать проект с большим количеством многих приложений, чтобы назвать их основное текстовое поле «текст»!
Просьба сообщить. Благодарю.