pythonfull-text-searchdjango-sphinx

django-sphinx: SphinxClient instance has no attribute 'SetFieldWeights'


In my models, when I refer to SphinxSearch with defaults like:

from djangosphinx.models import SphinxSearch

class Blog(models.Model):
    ...
    search = SphinxSearh()

the fulltext search works fine. But when I give weights attribute as documented:

search = SphinxSearch(
    weights={'title': 10, 'body': 5, 'tags': 10}
)

searches raise: SphinxClient instance has no attribute 'SetFieldWeights'

I must be missing something obvious as I seem to be the only one with this problem after Googling. Any help is much appreciated.


Solution

  • This problem is coming due to version of sphinxapi, put

    SPHINX_API_VERSION = 0x116

    in your settings.py file. problem will get resolve.

    Default version getting picked up is 0x107, which doesn't have implemented 'SetFieldWeights' function.