mirror of
https://github.com/stashapp/stash.git
synced 2026-04-20 14:04:51 +02:00
feat: add image details to search filter (#6673)
* feat: add image details to search filter This change adds the image details field to the image search filter, allowing for better discovery of images based on their description. --------- Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
parent
7872029ffa
commit
c2e80d2676
3 changed files with 20 additions and 4 deletions
|
|
@ -837,7 +837,7 @@ func (qb *ImageStore) makeQuery(ctx context.Context, imageFilter *models.ImageFi
|
|||
)
|
||||
|
||||
filepathColumn := "folders.path || '" + string(filepath.Separator) + "' || files.basename"
|
||||
searchColumns := []string{"images.title", filepathColumn, "files_fingerprints.fingerprint"}
|
||||
searchColumns := []string{"images.title", "images.details", filepathColumn, "files_fingerprints.fingerprint"}
|
||||
query.parseQueryString(searchColumns, *q)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1596,6 +1596,20 @@ func TestImageQueryQ(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestImageQueryQ_Details(t *testing.T) {
|
||||
withTxn(func(ctx context.Context) error {
|
||||
const imageIdx = 3
|
||||
|
||||
q := getImageStringValue(imageIdx, detailsField)
|
||||
|
||||
sqb := db.Image
|
||||
|
||||
imageQueryQ(ctx, t, sqb, q, imageIdx)
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func queryImagesWithCount(ctx context.Context, sqb models.ImageReader, imageFilter *models.ImageFilterType, findFilter *models.FindFilterType) ([]*models.Image, int, error) {
|
||||
result, err := sqb.Query(ctx, models.ImageQueryOptions{
|
||||
QueryOptions: models.QueryOptions{
|
||||
|
|
|
|||
|
|
@ -306,6 +306,7 @@ const (
|
|||
pathField = "Path"
|
||||
checksumField = "Checksum"
|
||||
titleField = "Title"
|
||||
detailsField = "Details"
|
||||
urlField = "URL"
|
||||
zipPath = "zipPath.zip"
|
||||
firstSavedFilterName = "firstSavedFilterName"
|
||||
|
|
@ -1305,9 +1306,10 @@ func makeImage(i int) *models.Image {
|
|||
tids := indexesToIDs(tagIDs, imageTags[i])
|
||||
|
||||
return &models.Image{
|
||||
Title: title,
|
||||
Rating: getIntPtr(getRating(i)),
|
||||
Date: getObjectDate(i),
|
||||
Title: title,
|
||||
Details: getImageStringValue(i, detailsField),
|
||||
Rating: getIntPtr(getRating(i)),
|
||||
Date: getObjectDate(i),
|
||||
URLs: models.NewRelatedStrings([]string{
|
||||
getImageEmptyString(i, urlField),
|
||||
}),
|
||||
|
|
|
|||
Loading…
Reference in a new issue