views:

43

answers:

1

Hi,

I'm trying to create full text search on model, everything goes fine when searching TextFields but I have a problem with ForeignKey field.

How can i do that? Can anyone point me to the right direction?

Thanks

Model example:

class Model1(models.Model):

 text_field =models.TextField(max_length=250)
 fk_field = models.ForeignKey('Model2')

class Model2(models.Model):

 text_field = models.TextField(max_length=250)

Thanks

R.

+1  A: 

I would like to see your sphinx.conf.

Well for this which creating your indexer in sphinx.conf you need to specify what fields you select. After that what fields from your sql you select to be put as attributes (i.e. non searchable fields).

I suppose search with foreign-key fields are just as normal search. What particular difficulty/error are you facing?

MovieYoda