Skip to content

Instantly share code, notes, and snippets.

@reiddraper
Created December 31, 2011 04:27
Show Gist options
  • Save reiddraper/1542875 to your computer and use it in GitHub Desktop.
Save reiddraper/1542875 to your computer and use it in GitHub Desktop.
sumo querying ideas
; 2i queries
(index-query conn :age 25)
(index-query conn :age 21 80)
(index-query conn :last-name "a" "f")
; is it too much of an abstraction to launch
; a mapreduce query which gets the docs and not
; just the keys?
(index-query conn :email "foo@example.com" :return-body true)
; map reduce calls start with an input, then
; a vector of map or reduce funcs
(mapreduce conn (:index :age 21 80)
[(:javascript "function (obj) {...}")
(:built-in "reduce_sort")]))
; links
; starts with a bucket/key
; and then a list of bucket/link-tags
; specs
(link-walk conn "bucket" "key"
[("other-bucket" "tag1" :keep true)
("second-bucket" "tag2")])
@bretthoerner
Copy link

index-query seems fine, I think fetch-body is fine too since it's a common case. Does it need to accept a connection and bucket though? I haven't used 2i much, tbh.

For query, do you not need to distinguish between map and reduce in the API? Does Riak not care, I thought it'd need to know what each function was "for"? I think it'd be useful for code reading to do something like (map/js "func...") (map/builtin "foo") (reduce/builtin "bar"). I could be totally wrong. :)

Link walking looks good to me, too.

@reiddraper
Copy link
Author

  • re: connection argument; yes, I just forgot about it.
  • re: naming phases; yep, another omission

@reiddraper
Copy link
Author

@bretthoerner, what do you think about these options for identifying language/func-type?

; named funcs
(map/js "func")
(reduce/js "func")

; keywords
(:map-js "function () {...}")
(:reduce-builtin "reduce_sort")

; hash
{:lang :js :type :map :src "function () {...}"}

@reiddraper
Copy link
Author

I created issue #9 for mapreduce

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