- Format.eprintf "\n%!";
-
- Printf.eprintf "TopDown (No BackTrack) : \n";
- time (TopDown.run auto) v;
- P(Printf.eprintf "Max states in TopDownNOBT : %i\n%!" auto.max_states);
- begin
- match output with
- | None -> ()
- | Some f ->
-
- Printf.eprintf "Serializing results : ";
- time( fun () ->
- let oc = open_out f in
- output_string oc "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
- BST.iter (fun t -> Tree.Binary.print_xml_fast oc t;
- output_string oc "\n------------------";
- output_char oc '\n') auto.result) ();
- end;
- Printf.eprintf "Total time : %fms\n Coherence : %i\n%!" (total_time())
-;;
+ Format.fprintf Format.err_formatter "\n%!";
+ Printf.eprintf "Compiling query : ";
+ let auto,ltags,contains = time (XPath.Compile.compile ~querystring:query_string) query in
+ let _ = Ata.dump Format.err_formatter auto in
+ let _ = Printf.eprintf "%!" in
+ let jump_to =
+ match contains with
+ None -> (max_int,`NOTHING)
+ | Some s ->
+ let r = Tree.count v s
+ in
+ Printf.eprintf "%i documents in the TextCollection\n" (Tree.text_size v);
+ Printf.eprintf "Global count is %i, using " r;
+ if r < !Options.tc_threshold then begin
+ Printf.eprintf "TextCollection contains\nCalling global contains : ";
+ time (Tree.init_contains v) s;
+ end
+ else begin
+ Printf.eprintf "Naive contains\nCalling global contains : ";
+ time (Tree.init_naive_contains v) s
+ end;(r,`CONTAINS(s))
+ in
+ let test_list =
+ if (!Options.backward) then begin
+ Printf.eprintf "Finding min occurences : ";
+ time
+ ( List.fold_left (fun ((min_occ,kind)as acc) (tag,_) ->
+ let numtags = Tree.subtree_tags v tag Tree.root in
+ if ((numtags < min_occ) && numtags >= 2)
+ then (numtags,`TAG(tag))
+ else acc) jump_to) ltags
+ end
+ else (max_int,`NOTHING)
+ in
+ let _ = if (snd test_list) != `NOTHING then
+ let occ,s1,s2 = match test_list with
+ | (x,`TAG (tag)) -> (x, "tag", (Tag.to_string tag))
+ | (x,`CONTAINS(s)) -> (x, "contains()", s)
+ | _ -> assert false
+ in
+ Printf.eprintf "Will jump to %s %s occuring %i time\n%!" s1 s2 occ
+ in
+ Printf.eprintf "Execution time %s : "
+ (if !Options.count_only then "(counting only)" else if !Options.backward then "(bottomup)" else "");
+ begin
+ let _ = Gc.full_major();Gc.compact() in
+ let _ = Printf.eprintf "%!" in
+ (* let _ = Gc.set (disabled_gc) in *)
+ if !Options.backward && ((snd test_list) != `NOTHING )then