X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FsearchEngine%2FsearchEngine.ml;h=5e742b243a6b9d04c0b1f6b96a5c89d92e49dda4;hb=a69b6f01bfeda05c431325a5defb5c5592427791;hp=35270fd62c8ee31d46ca2469a819b94e57ebfeb8;hpb=718bc0ea70defa418c23850dbb8f2850b0c3a542;p=helm.git diff --git a/helm/searchEngine/searchEngine.ml b/helm/searchEngine/searchEngine.ml index 35270fd62..5e742b243 100644 --- a/helm/searchEngine/searchEngine.ml +++ b/helm/searchEngine/searchEngine.ml @@ -33,14 +33,16 @@ Http_common.debug := true;; (** accepted HTTP servers for ask_uwobo method forwarding *) let valid_servers = [ "mowgli.cs.unibo.it:58080" ; "mowgli.cs.unibo.it" ; "localhost:58080" ] ;; -open Printf;; +module MQICallbacks = + struct + let log s = debug_print s + end -let postgresConnectionString = - try - Sys.getenv "POSTGRESQL_CONNECTION_STRING" - with - Not_found -> "host=mowgli.cs.unibo.it dbname=helm_mowgli_new_schema user=helm" -;; +module MQI = MQueryInterpreter.Make(MQICallbacks) + +let mqi_options = "" (* default MathQL interpreter options *) + +open Printf;; let daemon_name = "Search Engine";; let default_port = 58085;; @@ -182,7 +184,7 @@ let callback (req: Http_types.request) outchan = try debug_print (sprintf "Received request: %s" req#path); if req#path <> "/getpage" then - Mqint.init postgresConnectionString; + ignore (MQI.init mqi_options); (match req#path with | "/execute" -> let query_string = req#param "query" in @@ -440,7 +442,7 @@ List.iter (fun u -> prerr_endline ("<" ^ Netencoding.Url.decode u ^ ">")) tail; | invalid_request -> Http_daemon.respond_error ~status:(`Client_error `Bad_request) outchan); if req#path <> "/getpage" then - Mqint.close (); + MQI.close mqi_options; debug_print (sprintf "%s done!" req#path) with | Chat_unfinished -> prerr_endline "Chat unfinished, Try again!" @@ -456,7 +458,6 @@ printf "Current directory is %s\n" (Sys.getcwd ()); printf "HTML directory is %s\n" pages_dir; flush stdout; Unix.putenv "http_proxy" ""; -Mqint.set_database Mqint.postgres_db; Http_daemon.start' ~port callback; printf "%s is terminating, bye!\n" daemon_name