Autotag scraper (#1817)

* Refactor scraper structures
* Move matching code into new package
* Add autotag scraper
* Always check first letter of auto-tag names
* Account for nulls

Co-authored-by: Kermie <kermie@isinthe.house>
This commit is contained in:
WithoutPants
2021-10-11 23:06:06 +11:00
committed by GitHub
parent b5381ff071
commit e9d48683f8
22 changed files with 1023 additions and 660 deletions

View File

@@ -182,11 +182,15 @@ func (qb *performerQueryBuilder) QueryForAutoTag(words []string) ([]*models.Perf
var whereClauses []string
var args []interface{}
whereClauses = append(whereClauses, "name regexp ?")
args = append(args, "^[\\w][.\\-_ ]")
for _, w := range words {
whereClauses = append(whereClauses, "name like ?")
args = append(args, w+"%")
whereClauses = append(whereClauses, "aliases like ?")
args = append(args, w+"%")
// TODO - commented out until alias matching works both ways
// whereClauses = append(whereClauses, "aliases like ?")
// args = append(args, w+"%")
}
where := strings.Join(whereClauses, " OR ")