Let's say you have this hierarchy of models and I want to index the hostname
and *all* the installations on each of the disks and slots of that specific
host. Well, it doesn't seem to work. After looking at indexer.Field.resolve() I
noticed there's no recursion at all, it's meant to handle only 2 levels of
relationships.
Tip: did you look at django-piston's solution to this ?
http://bitbucket.org/jespern/django-piston/src/tip/piston/emitters.py#cl-90
# models.py
class Host(models.Model):
hostname = models.CharField()
class Disk(models.Model):
host = models.ForeignKey(Host)
class Slot(models.Model):
disk = models.ForeignKey(Disk)
class Installation(models.Model):
slot = models.OneToOneField(Slot)
product = models.CharField()
# index.py
class HostIndexer(Indexer):
tags = [
('hostname', 'hostname'),
('product', 'disk_set.slot_set.installation.product'), # <-- Not working
]
space.add_index(Host, HostIndexer, attach_as='indexer')
Original issue reported on code.google.com by jonsibo...@gmail.com on 6 Jul 2010 at 10:29
Original issue reported on code.google.com by
jonsibo...@gmail.com
on 6 Jul 2010 at 10:29