X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FsearchEngine%2FmooglePp.ml;h=3af0afb4051f882f5251d44891ecc787c93cc232;hb=4167cea65ca58897d1a3dbb81ff95de5074700cc;hp=92b55668e5cbe9aa1f5e69194df01c8887d7b37b;hpb=a240236d1e9d5154e8cb5da73f8e98cf7734a73e;p=helm.git diff --git a/helm/searchEngine/mooglePp.ml b/helm/searchEngine/mooglePp.ml index 92b55668e..3af0afb40 100644 --- a/helm/searchEngine/mooglePp.ml +++ b/helm/searchEngine/mooglePp.ml @@ -23,38 +23,37 @@ let theory_of_result page result = Helm_registry.get_int "search_engine.results_per_page" in let results_no = List.length result in + let buffer = Buffer.create (200 * results_no) in let result = paginate ~size:results_per_page ~page result in if results_no > 0 then let mode = "typeonly" in - let results = - let idx = ref ((page - 1) * results_per_page + List.length result + 1) in - List.fold_right - (fun uri i -> - decr idx ; - sprintf - " - %d. - %s - - - - - %s" - !idx uri uri mode i) - result "" + let output_results () = + let idx = ref ((page - 1) * results_per_page) in + List.iter + (fun uri -> + incr idx; + Printf.bprintf buffer + " + %d. + %s + + + + + " + !idx uri uri mode) result ; in let summary = sprintf "%d result%s found" results_no (if results_no > 1 then "s" else "") in - let results = - sprintf - " - %s -
" - results - in - (summary, results) + begin + Buffer.add_string buffer + ""; + output_results (); + Buffer.add_string buffer "
"; + (summary, Buffer.contents buffer) + end else ("no results found", "")