Skip to content

Commit

Permalink
Improve term search search speed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Feb 22, 2021
1 parent 44d9277 commit 80c6235
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Server/OntologyDB.fs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ SELECT max(ID) FROM Term"""
isObsolete
| false -> failwith "Inserting term failed."

open System

let getTermSuggestions cString (query:string) =

use connection = establishConnection cString
Expand All @@ -99,7 +101,15 @@ let getTermSuggestions cString (query:string) =

let queryParam = getTermSuggestionsCmd.Parameters.Add("query",MySqlDbType.VarChar)

queryParam .Value <- query
let query' =
if query.Contains " " then
query.Split([|" "|], StringSplitOptions.RemoveEmptyEntries)
|> Array.filter (fun x -> x.Length >= 3 )
|> String.concat " "
else
query

queryParam .Value <- query'

use reader = getTermSuggestionsCmd.ExecuteReader()
[|
Expand Down

0 comments on commit 80c6235

Please sign in to comment.