diff --git a/frontend/src/pages/album/photos.vue b/frontend/src/pages/album/photos.vue index 5732ece28..1bbff2990 100644 --- a/frontend/src/pages/album/photos.vue +++ b/frontend/src/pages/album/photos.vue @@ -282,12 +282,6 @@ export default { }, updateQuery() { this.filter.q = this.filter.q.trim(); - const len = this.filter.q.length; - - if (len > 1 && len < 3) { - this.$notify.error(this.$gettext("Search term too short")); - return; - } const query = { view: this.settings.view @@ -302,7 +296,7 @@ export default { } if (JSON.stringify(this.$route.query) === JSON.stringify(query)) { - return + return; } this.$router.replace({query: query}); diff --git a/frontend/src/pages/albums.vue b/frontend/src/pages/albums.vue index 8ad3fc3ae..7cfab4070 100644 --- a/frontend/src/pages/albums.vue +++ b/frontend/src/pages/albums.vue @@ -417,12 +417,6 @@ export default { }, updateQuery() { this.filter.q = this.filter.q.trim(); - const len = this.filter.q.length; - - if (len > 1 && len < 3) { - this.$notify.error(this.$gettext("Search term too short")); - return; - } const query = { view: this.settings.view @@ -437,7 +431,7 @@ export default { } if (JSON.stringify(this.$route.query) === JSON.stringify(query)) { - return + return; } this.$router.replace({query: query}); diff --git a/frontend/src/pages/labels.vue b/frontend/src/pages/labels.vue index b0e1f7606..e0d0b0423 100644 --- a/frontend/src/pages/labels.vue +++ b/frontend/src/pages/labels.vue @@ -369,12 +369,6 @@ export default { }, updateQuery() { this.filter.q = this.filter.q.trim(); - const len = this.filter.q.length; - - if (len > 1 && len < 3) { - this.$notify.error(this.$gettext("Search term too short")); - return; - } const query = { view: this.settings.view @@ -389,7 +383,7 @@ export default { } if (JSON.stringify(this.$route.query) === JSON.stringify(query)) { - return + return; } this.$router.replace({query: query}); diff --git a/frontend/src/pages/library/errors.vue b/frontend/src/pages/library/errors.vue index 1f49d3460..59811f2ba 100644 --- a/frontend/src/pages/library/errors.vue +++ b/frontend/src/pages/library/errors.vue @@ -118,12 +118,6 @@ export default { methods: { updateQuery() { this.filter.q = this.filter.q.trim(); - const len = this.filter.q.length; - - if (len > 1 && len < 3) { - this.$notify.error(this.$gettext("Search term too short")); - return; - } const query = {}; @@ -136,7 +130,7 @@ export default { } if (JSON.stringify(this.$route.query) === JSON.stringify(query)) { - return + return; } this.$router.replace({query}); diff --git a/frontend/src/pages/library/files.vue b/frontend/src/pages/library/files.vue index c8895f18c..f2e31e5f8 100644 --- a/frontend/src/pages/library/files.vue +++ b/frontend/src/pages/library/files.vue @@ -332,12 +332,6 @@ export default { }, updateQuery() { this.filter.q = this.filter.q.trim(); - const len = this.filter.q.length; - - if (len > 1 && len < 3) { - this.$notify.error(this.$gettext("Search term too short")); - return; - } const query = { view: this.settings.view @@ -352,7 +346,7 @@ export default { } if (JSON.stringify(this.$route.query) === JSON.stringify(query)) { - return + return; } this.$router.replace({query: query}); diff --git a/frontend/src/pages/photos.vue b/frontend/src/pages/photos.vue index 7879d2b0d..199bb5f69 100644 --- a/frontend/src/pages/photos.vue +++ b/frontend/src/pages/photos.vue @@ -333,12 +333,6 @@ export default { }, updateQuery() { this.filter.q = this.filter.q.trim(); - const len = this.filter.q.length; - - if (len > 1 && len < 3) { - this.$notify.error(this.$gettext("Search term too short")); - return; - } const query = { view: this.settings.view diff --git a/frontend/src/pages/places.vue b/frontend/src/pages/places.vue index 543459002..68e890dfc 100644 --- a/frontend/src/pages/places.vue +++ b/frontend/src/pages/places.vue @@ -211,12 +211,6 @@ export default { }, updateQuery() { this.filter.q = this.filter.q.trim(); - const len = this.filter.q.length; - - if (len > 1 && len < 3) { - this.$notify.error(this.$gettext("Search term too short")); - return; - } if (this.query() !== this.filter.q) { if (this.filter.q) { diff --git a/frontend/src/share/albums.vue b/frontend/src/share/albums.vue index 8f2093e52..5be42f9ee 100644 --- a/frontend/src/share/albums.vue +++ b/frontend/src/share/albums.vue @@ -289,12 +289,6 @@ export default { }, updateQuery() { this.filter.q = this.filter.q.trim(); - const len = this.filter.q.length; - - if (len > 1 && len < 3) { - this.$notify.error(this.$gettext("Search term too short")); - return; - } const query = { view: this.settings.view @@ -309,7 +303,7 @@ export default { } if (JSON.stringify(this.$route.query) === JSON.stringify(query)) { - return + return; } this.$router.replace({query: query}); diff --git a/frontend/src/share/photos.vue b/frontend/src/share/photos.vue index fd66db4ff..8759031c7 100644 --- a/frontend/src/share/photos.vue +++ b/frontend/src/share/photos.vue @@ -322,12 +322,6 @@ export default { }, updateQuery() { this.filter.q = this.filter.q.trim(); - const len = this.filter.q.length; - - if (len > 1 && len < 3) { - this.$notify.error(this.$gettext("Search term too short")); - return; - } const query = { view: this.settings.view @@ -342,7 +336,7 @@ export default { } if (JSON.stringify(this.$route.query) === JSON.stringify(query)) { - return + return; } this.$router.replace({query: query}); diff --git a/pkg/txt/file_title.go b/pkg/txt/file_title.go index 5b5a386ee..c77ba868a 100644 --- a/pkg/txt/file_title.go +++ b/pkg/txt/file_title.go @@ -7,7 +7,7 @@ import ( "github.com/photoprism/photoprism/pkg/fs" ) -var FileTitleRegexp = regexp.MustCompile("[\\p{L}\\-,':&+!?]{1,}|( [&+] )?") +var FileTitleRegexp = regexp.MustCompile("[\\p{L}\\-,':&+!?!]{1,}|( [&+] )?") // FileTitle returns the string with the first characters of each word converted to uppercase. func FileTitle(s string) string { diff --git a/pkg/txt/file_title_test.go b/pkg/txt/file_title_test.go index 66ca9acf2..beb107570 100644 --- a/pkg/txt/file_title_test.go +++ b/pkg/txt/file_title_test.go @@ -10,6 +10,18 @@ func TestFileTitle(t *testing.T) { t.Run("桥", func(t *testing.T) { assert.Equal(t, "桥", FileTitle("桥")) }) + t.Run("桥船", func(t *testing.T) { + result := FileTitle("桥船") + assert.Equal(t, "桥船", result) + }) + t.Run("桥船猫", func(t *testing.T) { + result := FileTitle("桥船猫") + assert.Equal(t, "桥船猫", result) + }) + t.Run("谢谢!", func(t *testing.T) { + result := FileTitle("谢谢!") + assert.Equal(t, "谢谢!", result) + }) t.Run("i_love_you!", func(t *testing.T) { assert.Equal(t, "Love You!", FileTitle("i_love_you!")) }) diff --git a/pkg/txt/words_test.go b/pkg/txt/words_test.go index f516c86fd..5939b55bd 100644 --- a/pkg/txt/words_test.go +++ b/pkg/txt/words_test.go @@ -11,6 +11,18 @@ func TestWords(t *testing.T) { result := Words("桥") assert.Equal(t, []string{"桥"}, result) }) + t.Run("桥船", func(t *testing.T) { + result := Words("桥船") + assert.Equal(t, []string{"桥船"}, result) + }) + t.Run("桥船猫", func(t *testing.T) { + result := Words("桥船猫") + assert.Equal(t, []string{"桥船猫"}, result) + }) + t.Run("谢谢!", func(t *testing.T) { + result := Words("谢谢!") + assert.Equal(t, []string{"谢谢"}, result) + }) t.Run("I'm a lazy-brown fox!", func(t *testing.T) { result := Words("I'm a lazy-BRoWN fox!") assert.Equal(t, []string{"lazy-BRoWN", "fox"}, result) @@ -91,6 +103,22 @@ func TestFilenameKeywords(t *testing.T) { } func TestKeywords(t *testing.T) { + t.Run("桥", func(t *testing.T) { + result := Keywords("桥") + assert.Equal(t, []string{"桥"}, result) + }) + t.Run("桥船", func(t *testing.T) { + result := Keywords("桥船") + assert.Equal(t, []string{"桥船"}, result) + }) + t.Run("桥船猫", func(t *testing.T) { + result := Keywords("桥船猫") + assert.Equal(t, []string{"桥船猫"}, result) + }) + t.Run("谢谢!", func(t *testing.T) { + result := Keywords("谢谢!") + assert.Equal(t, []string{"谢谢"}, result) + }) t.Run("I'm a lazy brown fox!", func(t *testing.T) { result := Keywords("I'm a lazy BRoWN img!") assert.Equal(t, []string{"lazy", "brown"}, result)