This commit is contained in:
Aaron Bieber 2020-05-13 11:14:19 -06:00
parent 43daa3a5ad
commit 024c84cbff
3 changed files with 7 additions and 3 deletions

View File

@ -35,9 +35,11 @@ func NewSimilar() *ffcli.Command {
}
for _, e := range *resp {
fmt.Printf("%s\t%s\n",
fmt.Printf("%f : %s\n\t%s\n",
e.Similarity,
e.Title,
e.Headline)
fmt.Printf("-----------------------------------\n")
}
return nil

View File

@ -301,7 +301,8 @@ SELECT entry_id, similarity(body, $2) as similarity,
title from entries,
to_tsquery($2) q
WHERE user_id = $1 and
similarity(body, $2) > 0.0
similarity(body, $2) > 0.0 and
similarity(body, $2) < 1.0
order by similarity DESC
LIMIT 10
`

View File

@ -32,7 +32,8 @@ SELECT entry_id, similarity(body, $2) as similarity,
title from entries,
to_tsquery($2) q
WHERE user_id = $1 and
similarity(body, $2) > 0.0
similarity(body, $2) > 0.0 and
similarity(body, $2) < 1.0
order by similarity DESC
LIMIT 10;