From: Kim Nguyễn Date: Wed, 2 May 2012 12:26:42 +0000 (+0200) Subject: Add a command line option to disable the indexing of ignorable whitespaces. X-Git-Url: http://git.nguyen.vg/gitweb/?p=SXSI%2Fxpathcomp.git;a=commitdiff_plain;h=d3db422b91ed145abd0eccb83e96c97d6431fac6 Add a command line option to disable the indexing of ignorable whitespaces. --- diff --git a/src/options.ml b/src/options.ml index cec31bc..0c7c92d 100644 --- a/src/options.ml +++ b/src/options.ml @@ -1,7 +1,7 @@ open Utils open Format -let index_empty_texts = ref false +let index_empty_texts = ref true let sample_factor = ref 64 let disable_text_collection = ref false let tc_threshold = ref 60000 @@ -67,8 +67,8 @@ let spec = Arg.align "-f", Arg.Set_int(sample_factor), " sample factor [default=64]"; - "-i", Arg.Set(index_empty_texts), - " index empty texts [default=false]"; + "-ne", Arg.Clear(index_empty_texts), + " don't index empty texts [default=index]"; "-d", Arg.Set(disable_text_collection), " disable text collection[default=false]"; diff --git a/src/tree.ml b/src/tree.ml index df72de7..2b8c1aa 100644 --- a/src/tree.ml +++ b/src/tree.ml @@ -79,11 +79,13 @@ struct let do_text b t = if Buffer.length t > 0 then begin let s = Buffer.contents t in - begin - open_tag b "<$>"; - text b s; - close_tag b "<$>"; - end; + if (!Options.index_empty_texts) || not (is_whitespace s) then + begin + open_tag b "<$>"; + Printf.eprintf "Inserting >>%s<<\n" s; + text b s; + close_tag b "<$>"; + end; Buffer.clear t end diff --git a/tests/perf_tests/xmark_10.xml_timing.83e9f9d8f219 b/tests/perf_tests/xmark_10.xml_timing.83e9f9d8f219 new file mode 100644 index 0000000..a769340 --- /dev/null +++ b/tests/perf_tests/xmark_10.xml_timing.83e9f9d8f219 @@ -0,0 +1,4 @@ +/child::site/child::regions +Execution time: 1.353979ms +Number of results: 1 +/child::site/child::closed_auctions