Skip to content

Instantly share code, notes, and snippets.

@tsantero
Created September 4, 2013 19:36
Show Gist options
  • Save tsantero/6441780 to your computer and use it in GitHub Desktop.
Save tsantero/6441780 to your computer and use it in GitHub Desktop.
def get_index(index_name)
index_obj = self.bucket.get_or_new(index_name)
index = GSet.new
# If resolving siblings...
if index_obj.siblings.length > 1
index_obj.siblings.each { | obj |
if !obj.data.nil?
index.merge_json obj.data
end
}
resolved_obj = self.bucket.new(index_name)
resolved_obj.vclock = index_obj.vclock
# previous content type was mulitpart/mixed, reset to something more innocuous
resolved_obj.content_type = 'text/plain'
resolved_obj.data = index.to_json
resolved_obj.store(options={:returnbody => false})
elsif !index_obj.data.nil?
index.merge_json(index_obj.data)
end
return index
end
@Favorwilliams
Copy link

My Pleasure to write you,
My name is Favor Williams,
My email address is
( Favor24@live.com)
Am interested to know
more about you,
Contact me for my
photo and other
important issue via,

Favor24@live.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment