diff --git a/changelog/unreleased/enhancement-search-fulltext-filter b/changelog/unreleased/enhancement-search-fulltext-filter index ec5060a15f7..c64a6d42262 100644 --- a/changelog/unreleased/enhancement-search-fulltext-filter +++ b/changelog/unreleased/enhancement-search-fulltext-filter @@ -3,4 +3,5 @@ Enhancement: Search full-text filter The search result page now has a full-text filter which can be used to filter the displayed files by their content. https://github.com/owncloud/web/pull/9059 +https://github.com/owncloud/web/pull/9087 https://github.com/owncloud/web/issues/9058 diff --git a/packages/web-app-files/src/components/Search/List.vue b/packages/web-app-files/src/components/Search/List.vue index 19b5443335f..f45243a1135 100644 --- a/packages/web-app-files/src/components/Search/List.vue +++ b/packages/web-app-files/src/components/Search/List.vue @@ -28,6 +28,7 @@ { @@ -261,6 +263,7 @@ export default defineComponent({ ...useResourcesViewDefaults(), loadAvailableTagsTask, fileListHeaderY, + fullTextSearchEnabled, getSpace, availableTags, tagFilter diff --git a/packages/web-app-files/tests/unit/components/Search/List.spec.ts b/packages/web-app-files/tests/unit/components/Search/List.spec.ts index ce8309e4729..41a51665957 100644 --- a/packages/web-app-files/tests/unit/components/Search/List.spec.ts +++ b/packages/web-app-files/tests/unit/components/Search/List.spec.ts @@ -63,13 +63,17 @@ describe('List component', () => { }) }) describe('fullText', () => { - it('should render filter', () => { - const { wrapper } = getWrapper() + it('should render filter if enabled via capabilities', () => { + const { wrapper } = getWrapper({ fullTextSearchEnabled: true }) expect(wrapper.find(selectors.fullTextFilter).exists()).toBeTruthy() }) it('should set initial filter when fullText is set active via query param', async () => { const searchTerm = 'term' - const { wrapper } = getWrapper({ searchTerm, fullTextFilterQuery: 'true' }) + const { wrapper } = getWrapper({ + searchTerm, + fullTextFilterQuery: 'true', + fullTextSearchEnabled: true + }) await wrapper.vm.loadAvailableTagsTask.last expect(wrapper.emitted('search')[0][0]).toEqual(`Content:"${searchTerm}"`) }) @@ -82,7 +86,8 @@ function getWrapper({ resources = [], searchTerm = '', tagFilterQuery = null, - fullTextFilterQuery = null + fullTextFilterQuery = null, + fullTextSearchEnabled = false } = {}) { jest.mocked(queryItemAsString).mockImplementationOnce(() => searchTerm) jest.mocked(queryItemAsString).mockImplementationOnce(() => fullTextFilterQuery) @@ -98,7 +103,9 @@ function getWrapper({ mockAxiosResolve({ value: availableTags }) ) const storeOptions = defaultStoreMockOptions - storeOptions.getters.capabilities.mockReturnValue({ files: { tags: true } }) + storeOptions.getters.capabilities.mockReturnValue({ + files: { tags: true, full_text_search: fullTextSearchEnabled } + }) const store = createStore(storeOptions) return { mocks, diff --git a/packages/web-pkg/src/composables/capability/useCapability.ts b/packages/web-pkg/src/composables/capability/useCapability.ts index 55121c892ee..8ad5987fa5f 100644 --- a/packages/web-pkg/src/composables/capability/useCapability.ts +++ b/packages/web-pkg/src/composables/capability/useCapability.ts @@ -102,6 +102,10 @@ export const useCapabilityFilesAppProviders = createCapabilityComposable