Handle auto-tagging where filename has no whitespace in name (#1488)

This commit is contained in:
WithoutPants
2021-06-08 10:47:22 +10:00
committed by GitHub
parent 099b4ecc56
commit f843359ba3
5 changed files with 12 additions and 5 deletions

View File

@@ -87,7 +87,13 @@ func getPathWords(path string) []string {
var ret []string
for _, w := range words {
if len(w) > 1 {
ret = append(ret, w)
// #1450 - we need to open up the criteria for matching so that we
// can match where path has no space between subject names -
// ie name = "foo bar" - path = "foobar"
// we post-match afterwards, so we can afford to be a little loose
// with the query
// just use the first two characters
ret = append(ret, w[0:2])
}
}

View File

@@ -185,9 +185,9 @@ func (qb *performerQueryBuilder) QueryForAutoTag(words []string) ([]*models.Perf
for _, w := range words {
whereClauses = append(whereClauses, "name like ?")
args = append(args, "%"+w+"%")
args = append(args, w+"%")
whereClauses = append(whereClauses, "aliases like ?")
args = append(args, "%"+w+"%")
args = append(args, w+"%")
}
where := strings.Join(whereClauses, " OR ")

View File

@@ -132,7 +132,7 @@ func (qb *studioQueryBuilder) QueryForAutoTag(words []string) ([]*models.Studio,
for _, w := range words {
whereClauses = append(whereClauses, "name like ?")
args = append(args, "%"+w+"%")
args = append(args, w+"%")
}
where := strings.Join(whereClauses, " OR ")

View File

@@ -214,7 +214,7 @@ func (qb *tagQueryBuilder) QueryForAutoTag(words []string) ([]*models.Tag, error
var args []interface{}
for _, w := range words {
ww := "%" + w + "%"
ww := w + "%"
whereClauses = append(whereClauses, "tags.name like ?")
args = append(args, ww)

View File

@@ -18,6 +18,7 @@
* Add button to remove studio stash ID. ([#1378](https://github.com/stashapp/stash/pull/1378))
### 🐛 Bug fixes
* Fix auto-tagger not tagging scenes with no whitespace in name. ([#1488](https://github.com/stashapp/stash/pull/1488))
* Fix click/drag to select scenes. ([#1476](https://github.com/stashapp/stash/pull/1476))
* Fix clearing Performer and Movie ratings not working. ([#1429](https://github.com/stashapp/stash/pull/1429))
* Fix scraper date parser failing when parsing time. ([#1431](https://github.com/stashapp/stash/pull/1431))