adding better search
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paul 2024-09-08 18:05:33 +02:00
parent 08c6d20559
commit b43a8b47e2
2 changed files with 4 additions and 4 deletions

View File

@ -262,9 +262,9 @@ func ToSlice(qrz Qrz) (out []string) {
type Qrz struct { type Qrz struct {
ID int `db:"id" xorm:"pk autoincr"` ID int `db:"id" xorm:"pk autoincr"`
QRZ string `db:"qrz" xorm:"index notnull"` QRZ string `db:"qrz" xorm:"index notnull"`
DMRID string `db:"dmrid" xorm:"notnull"` DMRID string `db:"dmrid" xorm:"index notnull"`
Name string `db:"name" xorm:"index notnull"` Name string `db:"name" xorm:"index notnull"`
Address string `db:"address" xorm:"notnull"` Address string `db:"address" xorm:"index notnull"`
City string `db:"city" xorm:"index notnull"` City string `db:"city" xorm:"index notnull"`
Zipcode string `db:"zipcode" xorm:"index varchar(5) notnull"` Zipcode string `db:"zipcode" xorm:"index varchar(5) notnull"`
Dept string `db:"dept" xorm:"index notnull"` Dept string `db:"dept" xorm:"index notnull"`

View File

@ -226,9 +226,9 @@ func SetSearchLike(config config.Config, qrzdt *QrzDatatableInput) (searchstmt s
var searchstr string var searchstr string
switch config.DbType { switch config.DbType {
case "sqlite3": case "sqlite3":
searchstr = "%s LIKE '%%%s%%'" searchstr = "%s LIKE '%s%%'"
case "mysql": case "mysql":
searchstr = "%s LIKE '%%%s%%'" searchstr = "%s LIKE '%s%%'"
case "postgresql": case "postgresql":
searchstr = "%s ~* '%s'" searchstr = "%s ~* '%s'"
default: default: