diff --git a/bin/forester/App.ml b/bin/forester/App.ml index 9170f55..97065fe 100644 --- a/bin/forester/App.ml +++ b/bin/forester/App.ml @@ -45,8 +45,10 @@ let () = | Some trees -> List.filter (fun Tree.{title; _} -> + (* FIXME: We are currently only matching on the title.*) let re = Regexp.create ~flags:(Jstr.v "gi") (Jstr.v query) in - Option.is_some @@ Regexp.match' re (Jstr.v title)) + Option.is_some + @@ Regexp.match' re (Jstr.v (Option.value ~default:"" title))) trees | None -> [] in diff --git a/lib/app/Search_modal.ml b/lib/app/Search_modal.ml index 425b6a7..0aa902d 100644 --- a/lib/app/Search_modal.ml +++ b/lib/app/Search_modal.ml @@ -29,7 +29,11 @@ let render_results t ~on_select = let item_els = List.mapi (fun idx item -> - let li = El.li [El.txt' item.Tree.title] in + let li = + match item.Tree.title with + | Some title -> El.li [El.txt' title] + | None -> El.li [El.txt' item.Tree.uri] + in El.set_class (Jstr.v "search-modal-result") true li; if idx = t.selected_idx then El.set_class (Jstr.v "selected") true li; ignore diff --git a/lib/app/Tree.ml b/lib/app/Tree.ml index 92a2593..1cb4d2e 100644 --- a/lib/app/Tree.ml +++ b/lib/app/Tree.ml @@ -9,7 +9,7 @@ type t = { route: string; tags: string list; taxon: string option; - title: string; + title: string option; uri: string; } @@ -36,7 +36,7 @@ let jsont = |> mem "route" string ~enc:route |> mem "tags" (list string) ~enc:tags |> mem "taxon" string_null_is_none ~enc:taxon - |> mem "title" string ~enc:title + |> mem "title" string_null_is_none ~enc:title |> mem "uri" string ~enc:uri |> finish)) let forest_jsont = Jsont.list jsont