I've got the following Restaurant and Comment models. I'm doing full text search on some fields of the Restaurant model, as shown below in the RestaurantIndexer class. How can I do a full text search including the comments (i.e. a search returning Restaurant instances with the query contained in one or some fields defined in RestaurantIndexer or in the comment field of Comment instances)?
*********Restaurant model***************
class Restaurant(models.Model):
name = models.CharField(max_length=100)
country=models.ForeignKey(Country)
city=models.ForeignKey(City)
street=models.CharField(max_length=100)
street_number=models.PositiveSmallIntegerField()
postal_code=models.PositiveIntegerField(blank=True,null=True)
category=models.ManyToManyField(Category, blank=True,ull=True)
slug = models.SlugField(unique=True)
*********Comment model***************
class Comment(models.Model):
user = models.ForeignKey(User)
restaurant = models.ForeignKey(Restaurant)
submit_date = models.DateTimeField(blank = True, null = False)
comment = models.TextField()
*********Restaurant indexer***************
class RestaurantIndexer(Indexer):
tags = [
('name','name'),
('city','city'),
('country','country'),
('category', 'category'),
('tag','tag')
]
#how can I add Comment.comment?
space.add_index(Restaurant, RestaurantIndexer, attach_as='indexer')