X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=daemons%2Fwhelp%2FsearchEngine.ml;h=533e9df120a5261252d0503c3bb18fec3a8fdb34;hb=6ad533c972e6c9e9db53f38f972e7c0792160f2e;hp=e98bfe3567bf3ae10ad9fc30a6e76417d5c2f948;hpb=0a2d4485302b2e0c1710500def3731fb4d866cc9;p=helm.git diff --git a/daemons/whelp/searchEngine.ml b/daemons/whelp/searchEngine.ml index e98bfe356..533e9df12 100644 --- a/daemons/whelp/searchEngine.ml +++ b/daemons/whelp/searchEngine.ml @@ -37,7 +37,7 @@ exception Invalid_action of string (* invalid action for "/search" method *) exception Not_a_MutInd let daemon_name = "Whelp" -let configuration_file = "/projects/helm/etc/whelp.conf.xml" +let configuration_file = "searchEngine.conf.xml" let placeholders = [ "ACTION"; "ADVANCED"; "ADVANCED_CHECKED"; "CHOICES"; "CURRENT_CHOICES"; @@ -260,6 +260,7 @@ let send_results results moogle_TPL let exec_action dbd (req: Http_types.request) outchan = + let dbd = dbd () in let term_str = req#param "expression" in try if req#path = "/elim" && @@ -357,9 +358,8 @@ let exec_action dbd (req: Http_types.request) outchan = end in let module Disambiguate' = Disambiguate.Make(Chat) in -prerr_endline "VOVI"; - let ast = Grammar.Entry.parse CicNotationParser.term (Stream.of_string term_str) in -prerr_endline "VIVO"; + let ast = + CicNotationParser.parse_term (Ulexing.from_utf8_string term_str) in let (id_to_uris, metasenv, term) = match Disambiguate'.disambiguate_term ~dbd ~context ~metasenv @@ -373,7 +373,7 @@ prerr_endline "VIVO"; | "/match" -> Whelp.match_term ~dbd term | "/instance" -> Whelp.instance ~dbd term | "/hint" -> - let status = ProofEngineTypes.initial_status term metasenv in + let status = ProofEngineTypes.initial_status term metasenv [] in let intros = PrimitiveTactics.intros_tac () in let subgoals = ProofEngineTypes.apply_tactic intros status in (match subgoals with @@ -450,7 +450,7 @@ let callback dbd (req: Http_types.request) outchan = if expression = "" then send_results (`Results []) req outchan else begin - let results = Whelp.locate ~dbd expression in + let results = Whelp.locate ~dbd:(dbd ()) expression in let results = List.map UriManager.string_of_uri results in send_results (`Results results) req outchan end @@ -495,10 +495,10 @@ let restore_environment () = printf "done!\n"; flush stdout let read_notation () = - CicNotation2.load_notation ~include_paths:[] - (Helm_registry.get "search_engine.notations"); - CicNotation2.load_notation ~include_paths:[] - (Helm_registry.get "search_engine.interpretations") + ignore (CicNotation2.load_notation ~include_paths:[] + (Helm_registry.get "search_engine.notations")); + ignore (CicNotation2.load_notation ~include_paths:[] + (Helm_registry.get "search_engine.interpretations")) let _ = printf "%s started and listening on port %d\n" daemon_name port; @@ -506,15 +506,15 @@ let _ = printf "HTML directory is %s\n" pages_dir; flush stdout; Unix.putenv "http_proxy" ""; - let dbd = - HMysql.quick_connect - ~host:(Helm_registry.get "db.host") - ~database:(Helm_registry.get "db.database") - ~user:(Helm_registry.get "db.user") - () + let dbd () = + let dbd = LibraryDb.instance () in + MetadataTypes.ownerize_tables "searchEngine"; + LibraryDb.create_owner_environment (); + dbd in restore_environment (); read_notation (); - Http_daemon.start' ~port (callback dbd); + let d_spec = Http_daemon.daemon_spec ~port ~callback:(callback dbd) ~auto_close:true () in + Http_daemon.main d_spec; printf "%s is terminating, bye!\n" daemon_name