MCPcopy Create free account
hub / github.com/codeaashu/claude-code / apiSearch

Function apiSearch

web/lib/search/search-api.ts:16–36  ·  view source on GitHub ↗
(
  query: string,
  filters: SearchFilters = {},
  page = 0,
  pageSize = 20,
  apiUrl = ""
)

Source from the content-addressed store, hash-verified

14}
15
16export async function apiSearch(
17 query: string,
18 filters: SearchFilters = {},
19 page = 0,
20 pageSize = 20,
21 apiUrl = ""
22): Promise<SearchApiResponse> {
23 const params = new URLSearchParams({ q: query, page: String(page), pageSize: String(pageSize) });
24
25 if (filters.dateFrom) params.set("dateFrom", String(filters.dateFrom));
26 if (filters.dateTo) params.set("dateTo", String(filters.dateTo));
27 if (filters.role) params.set("role", filters.role);
28 if (filters.conversationId) params.set("conversationId", filters.conversationId);
29 if (filters.contentType) params.set("contentType", filters.contentType);
30 if (filters.model) params.set("model", filters.model);
31 if (filters.tagIds?.length) params.set("tagIds", filters.tagIds.join(","));
32
33 const res = await fetch(`${apiUrl}/api/search?${params.toString()}`);
34 if (!res.ok) throw new Error(`Search API error: ${res.status}`);
35 return res.json() as Promise<SearchApiResponse>;
36}

Callers

nothing calls this directly

Calls 2

toStringMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected