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 { for _, e := range *resp {
fmt.Printf("%s\t%s\n", fmt.Printf("%f : %s\n\t%s\n",
e.Similarity,
e.Title, e.Title,
e.Headline) e.Headline)
fmt.Printf("-----------------------------------\n")
} }
return nil return nil

View File

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

View File

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