Python Django haystack在国外场地上刻面
是否可以通过搜索索引在外部字段属性上刻面 search_index.pyPython Django haystack在国外场地上刻面,python,django,python-3.x,
elasticsearch,django-haystack,Python,Django,Python 3.x,
elasticsearch,Django Haystack,是否可以通过搜索索引在外部字段属性上刻面 search_index.py class ProductIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.EdgeNgramField( document=True, use_template=True, template_name='/home/wilkinj33/bargainforest/bargainforestenv/motorc
class ProductIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.EdgeNgramField(
document=True, use_template=True,
template_name='/home/wilkinj33/bargainforest/bargainforestenv/motorclass/templates/search/indexes/product_text.txt'
)
title = indexes.EdgeNgramField(model_attr='title')
retailer = indexes.CharField(model_attr='retailer', faceted=True)
price = indexes.IntegerField(model_attr='price', faceted=True)
barcode = indexes.CharField(model_attr='barcode')
def get_model(self):
return Product
def index_queryset(self, using=None):
"""Used when the entire index for model is updated."""
return self.get_model().objects.filter(timestamp__lte=timezone.now())
我想对下面的模型命名属性
class top_category(models.Model):
class Meta:
verbose_name_plural = 'Top Categories'
name = models.CharField(max_length=500)
def __str__(self):
return self.name
通过导入相关模型并以正常方式引用模型属性解决。通过导入相关模型并以正常方式引用模型属性解决。