I am trying to implement a sphinx search server on a website. The website is to be used for internal tracking.
The database defines a status, which I have configured to be a attribute in sphinx. I need this to be updated in real time without any lag. I also want to use disk indexes so regular updates to the index can be done quite easily and I avoid the SphinxQL.
I have found that this is possible via the UpdateAttribute method of the sphinx API.
What I want to know is if it is possible to call the UpdateAttribute() from a MySQL trigger? I thought I could have a php script that takes the required inputs in a get request and then updates the index. Please suggest possible ways to implement as I haven’t yet found anything that works.
If you have any other way of implementing the search so that I get attributes updated in real time then please let me know.
Thanks.
UpdateAttribute is the right method.
IMO it is possible to call this method in MySQL trigger using MySQL user defined function. But, I don’t think it is good solution, because such function will be very complex and will slow down mysql updates very much.
A much better solution was posted to the sphinxforums. Its using gearman and the present UDFs that exists for it. (technically writing UDF for the sphinx C API is better but this is just easier) see here.