-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Search does not find all files (#7267)
Show max results in search
- Loading branch information
Jan
authored
Jul 20, 2022
1 parent
5607bd3
commit 24314e4
Showing
7 changed files
with
71 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,41 @@ | ||
import { SearchList, SearchResult } from 'search/src/types' | ||
import { SearchList } from 'search/src/types' | ||
import ListComponent from '../../components/Search/List.vue' | ||
import { clientService } from 'web-pkg/src/services' | ||
import { buildResource } from '../../helpers/resources' | ||
import { Component } from 'vue' | ||
import { DavProperties } from 'web-pkg/src/constants' | ||
|
||
export const searchLimit = 200 | ||
|
||
export default class List implements SearchList { | ||
public readonly component: Component | ||
|
||
constructor() { | ||
this.component = ListComponent | ||
} | ||
|
||
async search(term: string): Promise<SearchResult[]> { | ||
async search(term: string): Promise<any> { | ||
if (!term) { | ||
return [] | ||
} | ||
|
||
const plainResources = await clientService.owncloudSdk.files.search( | ||
const searchResponse = await clientService.owncloudSdk.files.search( | ||
term, | ||
undefined, | ||
searchLimit, | ||
DavProperties.Default | ||
) | ||
|
||
return plainResources.map((plainResource) => { | ||
let resourceName = decodeURIComponent(plainResource.name) | ||
if (resourceName.startsWith('/dav')) { | ||
resourceName = resourceName.slice(4) | ||
} | ||
return { | ||
range: searchResponse.range, | ||
resources: searchResponse.results.map((plainResource) => { | ||
let resourceName = decodeURIComponent(plainResource.name) | ||
if (resourceName.startsWith('/dav')) { | ||
resourceName = resourceName.slice(4) | ||
} | ||
|
||
const resource = buildResource({ ...plainResource, name: resourceName }) | ||
return { id: resource.id, data: resource } | ||
}) | ||
const resource = buildResource({ ...plainResource, name: resourceName }) | ||
return { id: resource.id, data: resource } | ||
}) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters