djangosphinxdjango-sphinx

django-sphinx-db: raw sql queries, join with msql tables?


I am thinking of using django-sphinx-db https://pypi.python.org/pypi/django-sphinx-db

Before I install it, just thought I would check:

Is it possible to join the special sphinx tables with the regular mysql tables? Can I do this using raw queries?

Any other thoughts on django-sphinx-db? Any reason I should not use it?

I plan to index some text content in sphinx, but will have the matching images in a mysql table. So I would need to do a join of the content table and the image table.


Solution

  • Is it possible to join the special sphinx tables with the regular mysql tables?

    No.

    SphinxQL (and hence django-sphinx-db) is a seperate 'server'. So you connect to mysql to run mysql queries, and searchd to make sphinxql queries. They are on seperate physical servers with seperate connections.

    With django-sphinx-db you would use it to manage a connection, to the SphinxSearch instance, and your favorite system for accessing mysql server.

    You run the sphinx query, then fetch documents from mysql. Performing the 'join' in application code.

    --

    For joining need to use SphinxSE. Then you just use normal connections to mysql server, to run queries (the mysql server, via SphinxSE internally runs that actual sphinx query) http://sphinxsearch.com/docs/current.html#sphinxse

    In theroy can also use the FEDERATED mysql engine, to similar effect to SphinxSE. Just using FEDERATED to proxy though to a sphinxQL backend. But it will probably be tricky to get it to work.