Skip to content

Commit

Permalink
Use camelCase for fullText
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed May 23, 2023
1 parent 65b03c0 commit 0aac1c6
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
4 changes: 2 additions & 2 deletions changelog/unreleased/enhancement-search-fulltext-filter
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Enhancement: Search fulltext filter
Enhancement: Search full-text filter

The search result page now has a fulltext filter which can be used to filter the displayed files by their content.
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/issues/9058
12 changes: 12 additions & 0 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
services:
ocis:
ports:
- 9200:9200
environment:
# Search
SEARCH_EXTRACTOR_TYPE: "tika"
SEARCH_EXTRACTOR_TIKA_TIKA_URL: "http://host.docker.internal:9998"
tika:
image: apache/tika:latest
ports:
- 9998:9998
12 changes: 6 additions & 6 deletions packages/web-app-files/src/components/Search/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
</item-filter>
<item-filter-toggle
:filter-label="$gettext('Search in file content')"
filter-name="fulltext"
class="files-search-filter-fulltext oc-mr-s"
filter-name="fullText"
class="files-search-filter-full-text oc-mr-s"
/>
</div>
<app-loading-spinner v-if="loading" />
Expand Down Expand Up @@ -186,7 +186,7 @@ export default defineComponent({
const availableTags = ref<Tag[]>([])
const tagFilter = ref<VNodeRef>()
const tagParam = useRouteQuery('q_tags')
const fulltextParam = useRouteQuery('q_fulltext')
const fullTextParam = useRouteQuery('q_fullText')
const loadAvailableTagsTask = useTask(function* () {
const {
Expand All @@ -212,8 +212,8 @@ export default defineComponent({
const buildSearchTerm = (manuallyUpdateFilterChip = false) => {
let term = unref(searchTerm)
const fulltext = queryItemAsString(unref(fulltextParam))
if (fulltext) {
const fullTextQuery = queryItemAsString(unref(fullTextParam))
if (fullTextQuery) {
term = `Content:"${term}"`
}
Expand Down Expand Up @@ -245,7 +245,7 @@ export default defineComponent({
watch(
() => unref(route).query,
(newVal, oldVal) => {
const filters = ['q_fulltext', 'q_tags']
const filters = ['q_fullText', 'q_tags']
const isChange =
newVal?.term !== oldVal?.term || filters.some((f) => newVal[f] ?? '' !== oldVal[f] ?? '')
Expand Down
14 changes: 7 additions & 7 deletions packages/web-app-files/tests/unit/components/Search/List.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const selectors = {
noContentMessageStub: 'no-content-message-stub',
resourceTableStub: 'resource-table-stub',
tagFilter: '.files-search-filter-tags',
fulltextFilter: '.files-search-filter-fulltext'
fullTextFilter: '.files-search-filter-full-text'
}

describe('List component', () => {
Expand Down Expand Up @@ -62,14 +62,14 @@ describe('List component', () => {
expect(wrapper.emitted('search')[0][0]).toEqual(`${searchTerm} Tags:"${tagFilterQuery}"`)
})
})
describe('fulltext', () => {
describe('fullText', () => {
it('should render filter', () => {
const { wrapper } = getWrapper()
expect(wrapper.find(selectors.fulltextFilter).exists()).toBeTruthy()
expect(wrapper.find(selectors.fullTextFilter).exists()).toBeTruthy()
})
it('should set initial filter when fulltext is set active via query param', async () => {
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' })
await wrapper.vm.loadAvailableTagsTask.last
expect(wrapper.emitted('search')[0][0]).toEqual(`Content:"${searchTerm}"`)
})
Expand All @@ -82,10 +82,10 @@ function getWrapper({
resources = [],
searchTerm = '',
tagFilterQuery = null,
fulltextFilterQuery = null
fullTextFilterQuery = null
} = {}) {
jest.mocked(queryItemAsString).mockImplementationOnce(() => searchTerm)
jest.mocked(queryItemAsString).mockImplementationOnce(() => fulltextFilterQuery)
jest.mocked(queryItemAsString).mockImplementationOnce(() => fullTextFilterQuery)
jest.mocked(queryItemAsString).mockImplementationOnce(() => tagFilterQuery)

const resourcesViewDetailsMock = useResourcesViewDefaultsMock({
Expand Down

0 comments on commit 0aac1c6

Please sign in to comment.