Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

intersection between two collections  RSS feed

J. Cartwright
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I have a class "Content" where each instance contains a collection of Keywords. I'd like to create a query where I pass a set of Keywords and find all Content instances where any one of Keywords is referenced.

The following query seems to work for a single Keyword:

query="from Content as content where :keyword in elements(content.keywords)"),

However I can't seem to figure out how to apply a list of Keywords to it. This is how I would expect to do it via SQL:

# find content records that contain keywords 151 or 157
select distinct from content a, content_keyword b, keyword c where = b.content_id and b.keyword_id = and in (151,157);

Can anyone please help me here?


[ November 09, 2008: Message edited by: J. Cartwright ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!