Skip to content

Instantly share code, notes, and snippets.

topGroups map {
g =>
val num = NumericUtils.sortableLongToDouble(
NumericUtils.prefixCodedToLong(g.groupValue))
println("Group Numerical Value:" + num + "Group Encoded Value: " + g.groupValue)
}
[
{
"_id": "71562648-6acb-42bc-a182-df6b1f005b09",
"user_id": 0,
"name": {
"first": "Stephanie",
"last": "Kirkland"
},
"age": 35,
"location": {
{send_all_hits,#Ref<23272.0.0.6181>,
{httpd,
{mochiweb_request,#Port<0.24011>,'GET',
"/mango_test/_design/viewbug/_search/testidx?q=manager:true&limit=all",
{1,1},
{7,
{"host",
{'Host',"localhost:5984"},
{"cache-control",
{'Cache-Control',"max-age=0"},
{send_all_hits,#Ref<23272.0.0.6181>,
{httpd,
{mochiweb_request,#Port<0.24011>,'GET',
"/mango_test/_design/viewbug/_search/testidx?q=manager:true&limit=all",
{1,1},
{7,
{"host",
{'Host',"localhost:5984"},
{"cache-control",
{'Cache-Control',"max-age=0"},
case dreyfus_fabric_search:go(DbName, DDoc, IndexName, QueryArgs) of
{being_stream, From, Ref}->
{ok, Resp} = start_json_response(Req, 200),
dreyfus_index:send_all_hits(From, Ref, Resp, Req), % WE BLOCK AND WAIT UNTIL STREAM OF HITS IS COMPLETE
end_json_response(Resp);
handle_search_req(#httpd{method=Method, path_parts=[_, _, _, _, IndexName]}=Req
,#db{name=DbName}=Db, DDoc, RetryCount, RetryPause)
when Method == 'GET'; Method == 'POST' ->
twig:log(handle_search_req,"Initiate handle_search_req"),
Tonys-MacBook-Pro:dreyfus llamage$ git diff
diff --git a/src/dreyfus_httpd.erl b/src/dreyfus_httpd.erl
index b4f76bf..27e9acc 100644
--- a/src/dreyfus_httpd.erl
+++ b/src/dreyfus_httpd.erl
@@ -16,6 +16,7 @@ handle_search_req(Req, Db, DDoc) ->
handle_search_req(#httpd{method=Method, path_parts=[_, _, _, _, IndexName]}=Req
,#db{name=DbName}=Db, DDoc, RetryCount, RetryPause)
when Method == 'GET'; Method == 'POST' ->
+ twig:log(notice, "Initiate handle_search_req", []),
rexi_utils:recv(Workers, #shard.ref, fun handle_message/3,
State, infinity, 1000 * 60 * 60)
go(DbName, DDoc, IndexName, HttpResp, #index_query_args{bookmark=nil,limit=all}=QueryArgs) ->
Shards = dreyfus_util:get_shards(DbName, QueryArgs),
Workers0 = fabric_util:submit_jobs(Shards, dreyfus_rpc2, search_all,
[DDoc, IndexName, HttpResp, dreyfus_util:export(QueryArgs)]),
Counters = fabric_dict:init(Workers0, nil),
RexiMon = fabric_util:create_monitors(Workers0),
try
case fabric_util:stream_start(Workers0, #shard.ref) of
{ok, Workers} ->
try
go(DbName, DDoc, IndexName, QueryArgs, Counters, Bookmark,HttpResp) ->
{Workers, _} = lists:unzip(Counters),
#index_query_args{limit = Limit, sort = Sort} = QueryArgs,
Replacements = fabric_view:get_shard_replacements(DbName, Workers),
State = #state{
limit = Limit,
sort = Sort,
top_docs = #top_docs{total_hits=0,hits=[]},
counters = Counters,
start_args = [DDoc, IndexName, QueryArgs],