@@ -173,6 +173,7 @@ import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
173173import NcEmptyContent from ' @nextcloud/vue/dist/Components/NcEmptyContent.js'
174174import NcInputField from ' @nextcloud/vue/dist/Components/NcInputField.js'
175175import NcDialog from ' @nextcloud/vue/dist/Components/NcDialog.js'
176+ import { loadState } from ' @nextcloud/initial-state'
176177
177178import CustomDateRangeModal from ' ./CustomDateRangeModal.vue'
178179import FilterChip from ' ./SearchFilterChip.vue'
@@ -271,6 +272,7 @@ export default defineComponent({
271272 showDateRangeModal: false ,
272273 internalIsVisible: this .open ,
273274 initialized: false ,
275+ minSearchLength: loadState (' unified-search' , ' min-search-length' , 1 ),
274276 }
275277 },
276278
@@ -283,6 +285,10 @@ export default defineComponent({
283285 return ! this .isEmptySearch && this .results .length === 0
284286 },
285287
288+ isSearchQueryTooShort() {
289+ return this .searchQuery .length < this .minSearchLength
290+ },
291+
286292 showEmptyContentInfo() {
287293 return this .isEmptySearch || this .hasNoResults
288294 },
@@ -291,9 +297,16 @@ export default defineComponent({
291297 if (this .searching && this .hasNoResults ) {
292298 return t (' core' , ' Searching …' )
293299 }
294- if (this .isEmptySearch ) {
295- return t (' core' , ' Start typing to search' )
300+
301+ if (this .isSearchQueryTooShort ) {
302+ switch (this .minSearchLength ) {
303+ case 1 :
304+ return t (' core' , ' Start typing to search' )
305+ default :
306+ return t (' core' , ' Minimum search length is {minSearchLength} characters' , { minSearchLength: this .minSearchLength })
307+ }
296308 }
309+
297310 return t (' core' , ' No matching results' )
298311 },
299312
@@ -375,7 +388,7 @@ export default defineComponent({
375388 })
376389 },
377390 find(query : string , providersToSearchOverride = null ) {
378- if (query . length === 0 ) {
391+ if (this . isSearchQueryTooShort ) {
379392 this .results = []
380393 this .searching = false
381394 return
0 commit comments