Autotag optimisation (#2368)

* Add duration to autotag finish message
* No sorting scene/image/gallery where not specified
* Use an LRU cache for sqlite regexp function
* Compile path separator regex once
* Cache objects with single letter first names
* Move finished auto-tag log
* Add more verbose logging
* Add new changelog
This commit is contained in:
WithoutPants
2022-03-09 12:01:56 +11:00
committed by GitHub
parent 9ef3060452
commit d88515abcd
28 changed files with 440 additions and 199 deletions

View File

@@ -21,12 +21,6 @@ WHERE performers_tags.tag_id = ?
GROUP BY performers_tags.performer_id
`
// KNOWN ISSUE: using \p{L} to find single unicode character names results in
// very slow queries.
// Suggested solution will be to cache single-character names and not include it
// in the autotag query.
const singleFirstCharacterRegex = `^[\w][.\-_ ]`
type performerQueryBuilder struct {
repository
}
@@ -189,9 +183,6 @@ func (qb *performerQueryBuilder) QueryForAutoTag(words []string) ([]*models.Perf
var whereClauses []string
var args []interface{}
whereClauses = append(whereClauses, "name regexp ?")
args = append(args, singleFirstCharacterRegex)
for _, w := range words {
whereClauses = append(whereClauses, "name like ?")
args = append(args, w+"%")