Feat add actors to meilisearch (#1048)
* initial commit * update api docs * adds search token versioning * make id filterable * isLocal -> is_local * add iri to actor index * update gitignore * Merge remote-tracking branch 'origin/main' into feat-add-actors-to-meilisearch * fix sharing for newly discovered actors * fix ActorSearchResult type --------- Co-authored-by: Christian Beutel <>
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import type { Actor } from "$lib/models/activitypub/actor";
|
||||
import type { ActorSearchResult } from "$lib/models/activitypub/actor";
|
||||
import { defaultTrailSearchAttributes, type TrailSearchResult } from "$lib/models/trail";
|
||||
import { APIError } from "$lib/util/api_util";
|
||||
import type { Hits, MultiSearchParams, MultiSearchResponse, MultiSearchResult, SearchParams, SearchResponse } from "meilisearch";
|
||||
import type { ListResult } from "pocketbase";
|
||||
|
||||
export type LocationSearchResult = {
|
||||
name: string;
|
||||
@@ -262,16 +261,16 @@ export async function searchMulti(options: MultiSearchParams): Promise<MultiSear
|
||||
return response.results
|
||||
}
|
||||
|
||||
export async function searchActors(q: string, includeSelf: boolean = true): Promise<Actor[]> {
|
||||
export async function searchActors(q: string, includeSelf: boolean = true): Promise<ActorSearchResult[]> {
|
||||
try {
|
||||
const r = await fetch(`/api/v1/search/actor?q=${q}&includeSelf=${includeSelf}`,)
|
||||
|
||||
if (!r.ok) {
|
||||
return []
|
||||
}
|
||||
const response: ListResult<Actor> = await r.json()
|
||||
const response: SearchResponse<ActorSearchResult> = await r.json()
|
||||
|
||||
return response.items
|
||||
return response.hits
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
|
||||
|
||||
@@ -725,7 +725,7 @@ export async function searchResultToTrailList(hits: Hits<TrailSearchResult>): Pr
|
||||
expand: {
|
||||
author: {
|
||||
collectionId: "activitypub_actors",
|
||||
isLocal: (h.domain?.length ?? 0) == 0,
|
||||
is_local: (h.domain?.length ?? 0) == 0,
|
||||
id: h.author,
|
||||
icon: h.author_avatar,
|
||||
preferred_username: h.author_name,
|
||||
|
||||
Reference in New Issue
Block a user