Riak Search on "Sets" data-types

Alex De la rosa alex.rosa.box at gmail.com
Thu Aug 21 14:32:15 EDT 2014


Hi there,

For a project I'm building I'm saving a "keyword" and a "site" for an image
like this:

  bucket = client.bucket_type('tp_images').bucket('images')
  key = bucket.new(image_hash)
  key.registers['raw'].assign(base64.b64encode(image_data))
  key.registers['site'].assign('johnlewis.com')
  key.registers['keywords'].assign('cameras')
  key.store()

and querying the index like this to get the desired images:

  r = client.fulltext_search('ix_images', 'site_registers:johnlewis.com AND
keywords_registers:cameras', sort='clicks_counter desc', rows=5)

Imagine now that i want to associate the same image to different keywords,
having a SET instead of a REGISTER:

  bucket = client.bucket_type('tp_images').bucket('images')
  key = bucket.new(image_hash)
  key.registers['raw'].assign(base64.b64encode(image_data))
  key.registers['site'].assign('johnlewis.com')
  key.sets['keywords'].add('digital cameras')
  key.sets['keywords'].add('DLSR')
  key.store()

How to query the SET using Riak Search? Something like the "IN ()"
statement in traditional SQL:

  r = client.fulltext_search('ix_images', 'site_registers:johnlewis.com AND
keywords_set:???????', sort='clicks_counter desc', rows=5)

Thanks!
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20140821/00accefa/attachment.html>


More information about the riak-users mailing list