Try to fix indexing
This commit is contained in:
parent
141bddc0db
commit
3bf029616f
|
|
@ -79,8 +79,8 @@ class ProductQuerySet(models.QuerySet):
|
||||||
return self.select_related('product_type', 'establishment') \
|
return self.select_related('product_type', 'establishment') \
|
||||||
.prefetch_related('product_type__subtypes')
|
.prefetch_related('product_type__subtypes')
|
||||||
|
|
||||||
def with_es_related(self):
|
def with_extended_related(self):
|
||||||
"""Returns qs with related for ES indexing."""
|
"""Returns qs with almost all related objects."""
|
||||||
return self.with_base_related() \
|
return self.with_base_related() \
|
||||||
.prefetch_related('tags', 'standards', 'classifications', 'classifications__standard',
|
.prefetch_related('tags', 'standards', 'classifications', 'classifications__standard',
|
||||||
'classifications__classification_type', 'classifications__tags') \
|
'classifications__classification_type', 'classifications__tags') \
|
||||||
|
|
|
||||||
|
|
@ -113,4 +113,4 @@ class ProductDocument(Document):
|
||||||
related_models = [models.ProductType]
|
related_models = [models.ProductType]
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
return super().get_queryset().published().with_es_related()
|
return super().get_queryset().published().with_base_related()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user