fix: add column to posts table that is a string of content to use search index on
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
import SearchResults from '@/components/SearchResults';
|
||||
|
||||
export default function SearchPage({ params }: { params: { term: string } }) {
|
||||
return (
|
||||
<main className='flex flex-col items-center flex-1'>
|
||||
<div className='flex flex-col w-full max-w-4xl gap-4'>
|
||||
<h1 className='text-4xl font-bold'>Here's what we found</h1>
|
||||
<SearchResults term={params.term} />
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import SearchResults from '@/components/SearchResults';
|
||||
|
||||
export default function SearchPage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: { [key: string]: string | string[] | undefined };
|
||||
}) {
|
||||
let term = searchParams.term;
|
||||
|
||||
if (term === undefined) {
|
||||
term = '';
|
||||
}
|
||||
|
||||
if (Array.isArray(term)) {
|
||||
term = term.length > 0 ? term[0] : '';
|
||||
}
|
||||
|
||||
return (
|
||||
<main className='flex flex-col items-center flex-1'>
|
||||
<div className='flex flex-col w-full max-w-4xl gap-4'>
|
||||
<h1 className='text-4xl font-bold'>Here's what we found</h1>
|
||||
<SearchResults term={term} />
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -8,4 +8,6 @@ export type UserDto = {
|
||||
clerkUserId: string;
|
||||
};
|
||||
|
||||
export type PostWithUserDto = Doc<'posts'> & { user: UserDto };
|
||||
export type PostWithUserDto = Omit<Doc<'posts'>, 'contentText'> & {
|
||||
user: UserDto;
|
||||
};
|
||||
|
||||
@@ -63,7 +63,7 @@ export default function Navbar() {
|
||||
<form
|
||||
onSubmit={e => {
|
||||
e.preventDefault();
|
||||
router.push(`/search/${term}`);
|
||||
router.push(`/search?term=${term}`);
|
||||
}}
|
||||
className='flex w-full relative'
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user