- fun ~owner ~uri ~types ->
- let metadata = MetadataExtractor.compute_ind ~uri ~types in
- let uri_of (a,b,c) = a in
- let uris = UriManager.string_of_uri uri :: List.map uri_of metadata in
+ fun ~uri ~types ->
+ if not (already_indexed uri) then begin
+ let metadata = MetadataExtractor.compute_obj uri in
+ let uri_of (a,b,c) = a in
+ let uris = UriManager.string_of_uri uri :: List.map uri_of metadata in
+ let uri = UriManager.string_of_uri uri in
+ let columns = MetadataPp.columns_of_ind_metadata metadata in
+ execute_insert dbd query uri (columns :> columns);
+ List.iter (insert_const_no dbd) uris;
+ List.iter (fun (uri, name, _) -> insert_name ~dbd ~uri ~name) metadata
+ end
+*)
+
+(***** TENTATIVE HACK FOR THE DB SLOWDOWN - BEGIN *******)
+let analyze_index = ref 0
+let eventually_analyze dbd =
+ incr analyze_index;
+ if !analyze_index > 30 then
+ begin
+ let analyze t = "OPTIMIZE TABLE " ^ t ^ ";" in
+ List.iter
+ (fun table -> ignore (Mysql.exec dbd (analyze table)))
+ [name_tbl (); rel_tbl (); sort_tbl (); obj_tbl(); count_tbl()]
+ end
+
+(***** TENTATIVE HACK FOR THE DB SLOWDOWN - END *******)
+
+let index_obj ~dbd ~uri =
+ if not (already_indexed uri) then begin
+ eventually_analyze dbd;
+ let metadata = MetadataExtractor.compute_obj uri in
+ let uri_of (a,b,c) = (a,c) in