Compare commits

...

2 Commits

Author SHA1 Message Date
Urban Guacamole 19224e723c Fix search 3 years ago
Urban Guacamole e3cce3988b Fix uppercase infohashes 3 years ago

@ -101,7 +101,7 @@ func main() {
return
}
}
rows, err := db.Query("select infohash, name, length, s, l from search where vect @@ websearch_to_tsquery($1) and copyrighted = 'f' limit 150", q)
rows, err := db.Query("select infohash, name, length, s, l from search where vect @@ websearch_to_tsquery($1) and copyrighted = 'f' order by s desc limit 150", q)
if err != nil {
log.Print(err)
w.WriteHeader(http.StatusInternalServerError)

@ -7,6 +7,7 @@ import (
"log"
"os"
"strconv"
"strings"
"time"
"unicode/utf8"
@ -62,6 +63,8 @@ func main() {
}
added := time.Unix(addedUnix, 0)
name = strings.ToLower(name)
//fmt.Printf("Ih %v name %v len %v added %v", infohash, name, length, added)
_, err = db.Exec("INSERT INTO torrent (infohash, name, length, added) VALUES ($1, $2, $3, $4)", infohash, name, length, added)
if err, ok := err.(*pq.Error); ok { //dark magic

Loading…
Cancel
Save