Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing in-here search with empty query #10092

Merged
merged 4 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-in-here-search
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Allow empty search query in "in-here" search

Allowing empty search queries in the "in-here" search instead of fallback to search "everywhere".

https://github.com/owncloud/web/pull/10092
https://github.com/owncloud/web/issues/9970
2 changes: 1 addition & 1 deletion packages/web-app-files/src/components/Search/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ export default defineComponent({
query['mediatype'] = mediaTypeParams.split('+').map((t) => `"${t}"`)
updateFilter(mediaTypeFilter)
}

return (
// By definition (KQL spec) OR, AND or (GROUP) is implicit for simple cases where
// different or identical keys are part of the query.
Expand All @@ -420,6 +419,7 @@ export default defineComponent({

return acc
}, [])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the sort array helper before the join to make sure that the scope is at the end (just specify a sort callback function that does nothing else than sorting items starting with scope: to the end). Can be called in all cases, even on an empty result after the reducer finished, so you can keep the old structure of the code and only add the sort call.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

.sort((a, b) => a.startsWith('scope:') - b.startsWith('scope:'))
.join(' AND ')
)
}
Expand Down
1 change: 0 additions & 1 deletion packages/web-app-search/src/portals/SearchBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ export default defineComponent({
scope = unref(scopeQueryValue)
}
const useScope =
unref(term) &&
unref(currentFolderAvailable) &&
unref(locationFilterId) === SearchLocationFilterConstants.inHere
router.push(
Expand Down