|
|
|
@ -12,13 +12,14 @@ function search() {
|
|
|
|
|
export default async (params: URLSearchParams) => {
|
|
|
|
|
const res = [];
|
|
|
|
|
if (params.get("query") && params.get("type")) {
|
|
|
|
|
const search = originalWatt[
|
|
|
|
|
params.get("type") === "tag" ? "tagSearch" : "search"
|
|
|
|
|
]({
|
|
|
|
|
tags: (params.get("query") as string).split(","),
|
|
|
|
|
query: params.get("query") as string,
|
|
|
|
|
isTitle: params.get("type") === "title",
|
|
|
|
|
limit: 20
|
|
|
|
|
const search = originalWatt.search({
|
|
|
|
|
query:
|
|
|
|
|
params.get("type") === "tag"
|
|
|
|
|
? (params.get("query") as string).split(",")
|
|
|
|
|
: (params.get("query") as string),
|
|
|
|
|
type: params.get("type") as "text" | "title" | "tag", //cannot go wrong, will not go wrong, has never gone wrong
|
|
|
|
|
limit: 20,
|
|
|
|
|
sort: (params.get("sort") as string) ?? "hot" // migration trol
|
|
|
|
|
});
|
|
|
|
|
await search.update(Number(params.get("page") ?? 0));
|
|
|
|
|
for (let i = 0; i < search.results.length; i++) {
|
|
|
|
@ -82,6 +83,20 @@ export default async (params: URLSearchParams) => {
|
|
|
|
|
checked={params.get("type") === "tag"}
|
|
|
|
|
/>
|
|
|
|
|
<label for="tag">Tag search</label>
|
|
|
|
|
<select name="sort" id="sort">
|
|
|
|
|
<option
|
|
|
|
|
value="hot"
|
|
|
|
|
selected={params.get("sort") === "hot"}
|
|
|
|
|
>
|
|
|
|
|
Hot
|
|
|
|
|
</option>
|
|
|
|
|
<option
|
|
|
|
|
value="new"
|
|
|
|
|
selected={params.get("sort") === "new"}
|
|
|
|
|
>
|
|
|
|
|
New
|
|
|
|
|
</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="flex-direction: row !important;">
|
|
|
|
|