/hotels_project/agoda_db_app/search_indexes.py
Python | 18 lines | 12 code | 5 blank | 1 comment | 0 complexity | 6bd4b4148f8d39a492762fc71d733180 MD5 | raw file
1from haystack.indexes import *
2from haystack import site
3from agoda_db_app.models import HotelMainInfo
4
5
6class HotelIndex(SearchIndex):
7 overview = CharField(document=True, use_template=True)
8 hotel_name = CharField(model_attr='hotel_name')
9 rates_from_usd = DecimalField(model_attr='rates_from_usd')
10
11 def get_model(self):
12 return HotelMainInfo
13
14 def index_queryset(self):
15 """Used when the entire index for model is updated."""
16 return HotelMainInfo.objects.all()
17
18site.register(HotelMainInfo, HotelIndex)