Hello Pat, Thinking Sphinx is doing a great job for us lately, thanks to your help a couple of months ago! I am now coming back with a question, as I need would some advice from the expert...
We have a Contacts database that was indexed fairly easily until recently. A new feature was added in our project which allows users to share contacts. I have to make that searchable and it turns out to be some kind of nightmare. I would need to replace our current: has "IF(view_permission = 0, 0, contact_owner)", :as => :owner, :type => :integer into a "has viewers" parameter to filter the results. Instead of 'contact_owner',I would have a list of user ids whom can view the contact. That list of ids is basically a concatenation of the results from 4 queries (at the end of this message). I don't see this fitting in a "has" parameter. Could you recommend me a way of doing this? I was thinking of using a stored procedure, but AFAIK it's not possible to call a stored procedure from a "has"... Linking the queries using "union"? But AFAIK, I cannot concatenate the result set from UNIONs into a string that can be used by TS. Tweaking the config file? I'd rather not do that as it would cause changes in many other places (deployments, cron jobs, new instances of the project, team notification,...) but if it's the only solution, I can give it a try. Something else? The 4 queries, for person 92 in this case: - The contact owner: SELECT contact_owner from people where id = 92; - Users with whom the contact is manually shared: SELECT shared_contacts.user_id FROM people, shared_contacts WHERE people.id = 92 AND people.id = shared_contacts.person_id AND flag = 1; - The owner's assistants: select uwfs.user_id FROM people, users owner, user_work_fors uwfs WHERE people.id =92 AND owner.id = people.contact_owner AND owner.id = uwfs.work_for_id - From all this, I need to remove assistants from whom the contact is manually hidden: SELECT shared_contacts.user_id FROM people, shared_contacts WHERE people.id = 92 AND people.id = shared_contacts.person_id AND flag = 0; Thank you, Best regards Gedeon -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
