Many thanks, Pat. I got it work. And, of course, even greater thanks for all your work on TS: its a terrific tool.
- Shailen On Oct 5, 1:06 am, Pat Allan <[email protected]> wrote: > Hi Shailen > > define_index has a 'where' method, so you can add database WHERE clauses via > that: > > define_index > # fields > # attributes > > where "articles.published = TRUE" > end > > I'm guessing the articles table will be referenced by the fields or > attributes (thus ensuring the table is joined on). If that's not the cause, > then you could add the following line in as well: > > join articles > > Cheers > > -- > Pat > > On 05/10/2010, at 8:19 AM, Shailen wrote: > > > > > I would like to index only a subset of the entries in a table and am > > not sure how to tell TS to do that (I'm quite new to TS). > > > In my app I have users who perform a variety of roles: some write > > articles, others write comments, some have admin rights, other don't > > etc. I would like to index only those users who have published > > articles. There is a users table, an articles table and - since there > > is a many-to-many relationship between users and articles - an > > articles_users join table. I need to run the following sql to find > > users with published articles: > > > SELECT DISTINCT users.* FROM users, articles_users, articles > > WHERE users.id = articles_users.user_id > > AND articles.id = articles_users.article_id > > AND articles.published; > > > Is there a way I can ask TS to only index those users returned by this > > query? > > > - Shailen Tuli > > > -- > > 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 > > athttp://groups.google.com/group/thinking-sphinx?hl=en. -- 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.
