Skip to content

Commit bc01b05

Browse files
committed
WIP 💩(front) hack to use the fulltext search api
1 parent 2b92d41 commit bc01b05

File tree

1 file changed

+10
-1
lines changed
  • src/frontend/apps/impress/src/features/docs/doc-management/api

1 file changed

+10
-1
lines changed

src/frontend/apps/impress/src/features/docs/doc-management/api/useDocs.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,16 @@ export const constructParams = (params: DocsParams): URLSearchParams => {
4444
export type DocsResponse = APIList<Doc>;
4545
export const getDocs = async (params: DocsParams): Promise<DocsResponse> => {
4646
const searchParams = constructParams(params);
47-
const response = await fetchAPI(`documents/?${searchParams.toString()}`);
47+
let response
48+
49+
// HACK for fulltext search feature
50+
if (searchParams.has('title')) {
51+
searchParams.set('q', searchParams.get('title') || '');
52+
searchParams.delete('title');
53+
response = await fetchAPI(`documents/search?${searchParams.toString()}`);
54+
} else {
55+
response = await fetchAPI(`documents/?${searchParams.toString()}`);
56+
}
4857

4958
if (!response.ok) {
5059
throw new APIError('Failed to get the docs', await errorCauses(response));

0 commit comments

Comments
 (0)