diff options
| author | 2021-08-13 17:14:38 -0400 | |
|---|---|---|
| committer | 2021-08-13 17:14:38 -0400 | |
| commit | 87acf106bf466aeb7ad77c01cb23dd86211e985a (patch) | |
| tree | 760c275058af7ef29aed14eab231b6480a195e59 | |
| parent | makedb: fix "searchtable" being refered to its old name "cache" (diff) | |
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.
| -rw-r--r-- | makedb.ml | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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) |
