4 let set_index_type = function
5 | "default" -> text_index_type := 0
6 | "swcsa" -> text_index_type := 1
7 | "rlcsa" -> text_index_type := 2
8 | s -> raise (Arg.Bad(s))
10 let usage_msg = Printf.sprintf "%s [options] <input.{xml|srx}> 'query' [output]" Sys.argv.(0)
14 fun s -> match !pos with
15 | 0 -> input_file:= s;incr pos
16 | 1 -> query := s; incr pos
17 | 2 -> output_file := Some s; incr pos
18 | _ -> raise (Arg.Bad(s))
24 match Utils.String.explode t ':' with
26 let l = try int_of_string lvl with _ -> raise (Arg.Bad (lvl)) in
27 if Logger.is_logger tr then Logger.activate tr l
28 else raise (Arg.Bad (t))
29 | _ -> raise (Arg.Bad (t))
30 ) (Utils.String.explode s ',')
32 let pretty_loggers () =
33 ignore(flush_str_formatter());
36 (fun f s -> fprintf f "%s" s)
38 (Logger.available ());
39 flush_str_formatter ()
42 [ "-c", Arg.Set(count_only),
43 " counting only (don't materialize the result set)";
45 "-two", Arg.Set(twopass),
46 " Use twopass algorithm";
48 "-f", Arg.Set_int(sample_factor),
49 "<n> sample factor [default=64]";
51 "-ne", Arg.Clear(index_empty_texts),
52 " don't index empty texts [default=index]";
54 "-d", Arg.Set(disable_text_collection),
55 " disable text collection[default=false]";
57 "-s", Arg.Set_string(save_file),
58 "<save_file> save the intermediate representation into file.srx";
60 "-b", Arg.Set(bottom_up), " real bottom up run";
62 "-nj", Arg.Set(no_jump), " disable jumping";
64 "-nc", Arg.Set(no_cache), " disable caching";
66 "-nw", Arg.Set(no_wrap_results), " do not wrap results in <xml_results/>";
68 "-p", Arg.Set(do_perf), " dump perf counters (Linux only)";
70 "-index-type", Arg.Symbol ([ "default"; "swcsa"; "rlcsa" ],
72 " choose text index type";
74 "-r", Arg.Set_int(repeat),
75 " repeat query execution n time (benchmarking only, default 1)";
77 "-doc-stats", Arg.Set(docstats),
78 " Compute document statistics (performs full traversal)";
81 "-v", Arg.Set(verbose), " verbose mode"; ] @
84 "-log", Arg.String (set_logger),
85 "<logger1:l1,...,loggern:ln> enable logging with the specified level. Valid loggers are: "
93 let _ = Arg.parse spec anon_fun usage_msg
95 if (!pos > 3 || !pos < 2)
96 then begin Arg.usage spec usage_msg; exit 1 end;
97 Logger.set_verbose !verbose