+ let init_naive_contains t s =
+ let i,j = Tree.doc_ids t.doc (Tree.root t.doc)
+ in
+ let regexp = Str.regexp_string s in
+ let matching arg =
+ try
+ let _ = Str.search_forward regexp arg 0;
+ in true
+ with _ -> false
+ in
+ let rec loop n acc l =
+ if n >= j then acc,l
+ else
+ let s = (*Printf.eprintf "%i \n%!" n;*)Text.get_cached_text t.doc n
+ in
+ if matching s
+ then loop (n+1) (n::acc) (l+1)
+ else loop (n+1) acc l
+ in
+ let acc,l = loop i [] 0 in
+ let a = Array.create l Text.nil in
+ let _ = List.fold_left (fun cpt e -> a.(cpt) <- e; (cpt-1)) (l-1) acc
+ in
+ contains_array := a
+