开发者

Django Sphinx Foreign key search

开发者 https://www.devze.com 2022-12-28 05:55 出处:网络
I\'m trying to create full text search on model, everything goes fine when searching TextFields but I have a problem with ForeignKey field.

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_f开发者_如何转开发ield =models.TextField(max_length=250)
 fk_field = models.ForeignKey('Model2')

class Model2(models.Model):

 text_field = models.TextField(max_length=250)

Thanks

R.


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消