Backend: Remove unused duplicate filter from photo search

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-07-18 13:09:22 +02:00
parent cdf6982673
commit 9c1518c5ef
5 changed files with 2 additions and 22 deletions

View file

@ -21,7 +21,6 @@ type PhotoSearch struct {
Photo bool `form:"photo"`
Scan bool `form:"scan"`
Panorama bool `form:"panorama"`
Duplicate bool `form:"duplicate"`
Error bool `form:"error"`
Hidden bool `form:"hidden"`
Archived bool `form:"archived"`

View file

@ -61,7 +61,7 @@ func TestParseQueryString(t *testing.T) {
assert.Equal(t, float32(33.45343), form.Lat)
})
t.Run("valid query 2", func(t *testing.T) {
form := &PhotoSearch{Query: "chroma:200 title:\"test\" after:2018-01-15 duplicate:false favorite:true lng:33.45343166666667"}
form := &PhotoSearch{Query: "chroma:200 title:\"test\" after:2018-01-15 favorite:true lng:33.45343166666667"}
err := form.ParseQueryString()
@ -74,7 +74,6 @@ func TestParseQueryString(t *testing.T) {
assert.Equal(t, uint8(200), form.Chroma)
assert.Equal(t, "test", form.Title)
assert.Equal(t, time.Date(2018, 01, 15, 0, 0, 0, 0, time.UTC), form.After)
assert.Equal(t, false, form.Duplicate)
assert.Equal(t, float32(33.45343), form.Lng)
})
t.Run("valid query with filter", func(t *testing.T) {

View file

@ -18,7 +18,6 @@ type TestForm struct {
Hash string `form:"hash"`
Video bool `form:"video"`
Photo bool `form:"photo"`
Duplicate bool `form:"duplicate"`
Archived bool `form:"archived"`
Error bool `form:"error"`
Lat float32 `form:"lat"`

View file

@ -254,10 +254,6 @@ func PhotoSearch(f form.PhotoSearch) (results PhotoResults, count int, err error
s = s.Where("files.file_hash IN (?)", strings.Split(strings.ToLower(f.Hash), ","))
}
if f.Duplicate {
s = s.Where("files.file_duplicate = 1")
}
if f.Portrait {
s = s.Where("files.file_portrait = 1")
}

View file

@ -349,21 +349,7 @@ func TestPhotoSearch(t *testing.T) {
//t.Logf("results: %+v", photos)
assert.Equal(t, 1, len(photos))
})
t.Run("form.duplicate", func(t *testing.T) {
var f form.PhotoSearch
f.Query = "duplicate:true"
f.Count = 10
f.Offset = 0
photos, _, err := PhotoSearch(f)
if err != nil {
t.Fatal(err)
}
assert.LessOrEqual(t, 1, len(photos))
})
t.Run("form.portrait", func(t *testing.T) {
var f form.PhotoSearch
f.Query = "portrait:true"
@ -379,6 +365,7 @@ func TestPhotoSearch(t *testing.T) {
assert.LessOrEqual(t, 1, len(photos))
})
t.Run("form.mono", func(t *testing.T) {
var f form.PhotoSearch
f.Query = "mono:true"