Search code examples
pythondjangosearchfull-text-searchdjango-sphinx

Django Sphinx Text Search


I am trying out Sphinx search in my Django project. All setup done & it works but need some clarification from someone who has actually used this setup.

In my Sphinx search while indexing, I have used 'name' as the field in my MySQL to be searchable & all other fields in sql_query to be as attributes (according to Sphinx lingo).

So when I search from my Model instance in Django, I get the search results alright but it does not have the 'name' field in the search results. I get all the other attributes.

However, I get the 'id' of the search term. Technically, I could get the 'name' by again querying MySQL but I want to avoid this. Is there anything I am not doing here?


Solution

  • Here's a shot in the dark -

    Try to get the name of your index in sphinx.conf same as the table_name you are trying to index. This is a quirk which is missed by lot of people.