Use exact name matches in nameToTerm
This commit is contained in:
@ -127,7 +127,7 @@ hashToTerm conn hashText =
|
|||||||
|
|
||||||
nameToTerm :: Connection -> Text -> IO (Maybe StoredTerm)
|
nameToTerm :: Connection -> Text -> IO (Maybe StoredTerm)
|
||||||
nameToTerm conn nameText =
|
nameToTerm conn nameText =
|
||||||
queryMaybeOne conn (selectStoredTermFields <> " WHERE names LIKE ? ORDER BY created_at DESC LIMIT 1") (Only $ "%" <> nameText <> "%")
|
queryMaybeOne conn (selectStoredTermFields <> " WHERE names = ? ORDER BY created_at DESC LIMIT 1") (Only nameText)
|
||||||
|
|
||||||
listStoredTerms :: Connection -> IO [StoredTerm]
|
listStoredTerms :: Connection -> IO [StoredTerm]
|
||||||
listStoredTerms conn =
|
listStoredTerms conn =
|
||||||
@ -172,8 +172,8 @@ termVersions :: Connection -> String -> IO [(Text, T, Integer)]
|
|||||||
termVersions conn name = do
|
termVersions conn name = do
|
||||||
let nameText = T.pack name
|
let nameText = T.pack name
|
||||||
results <- query conn
|
results <- query conn
|
||||||
"SELECT hash, term_data, created_at FROM terms WHERE names LIKE ? ORDER BY created_at DESC"
|
"SELECT hash, term_data, created_at FROM terms WHERE names = ? ORDER BY created_at DESC"
|
||||||
(Only $ "%" <> nameText <> "%")
|
(Only nameText)
|
||||||
|
|
||||||
catMaybes <$> mapM (\(hashVal, termDataVal, timestamp) -> do
|
catMaybes <$> mapM (\(hashVal, termDataVal, timestamp) -> do
|
||||||
maybeT <- tryDeserializeTerm termDataVal
|
maybeT <- tryDeserializeTerm termDataVal
|
||||||
|
Reference in New Issue
Block a user