Use lowercase for all element names and symbols
The matching algorithm will work better when all names are normalized. For instance, a search of "iorn" will not list "iron" in the first three matches, but a search of "Iorn" will have "iron" as the first match.
This commit is contained in:
parent
905e5a933b
commit
87acf106bf
1 changed files with 6 additions and 5 deletions
11
makedb.ml
11
makedb.ml
|
@ -92,11 +92,12 @@ let makedb db json = let open Sqlite3
|
|||
(* Bind each column name. In SQLite3 the leading ":" is part
|
||||
of the named parameter. *)
|
||||
in let prep i x =
|
||||
(match colarr.(i) with
|
||||
| "Symbol" -> symbs := (x,None)::!symbs
|
||||
| "Name" -> names := (x,None)::!names
|
||||
| _ -> ()
|
||||
);
|
||||
let lcase = String.lowercase_ascii
|
||||
in let x = (match colarr.(i) with
|
||||
| "Symbol" -> symbs := (lcase x,None)::!symbs; lcase x
|
||||
| "Name" -> names := (lcase x,None)::!names; lcase x
|
||||
| _ -> x
|
||||
) in
|
||||
binds stmt colarr.(i)
|
||||
(if x = "" then Data.NULL else Data.TEXT x)
|
||||
|
||||
|
|
Loading…
Reference in a new issue