feat: show distinct attribute keys in cmd-k Attributes tab
Add GET /search/attributes/keys endpoint that queries distinct attribute key names from ClickHouse using JSONExtractKeys. Attribute keys appear in the cmd-k Attributes tab alongside attribute value matches from exchange results. - SearchIndex.distinctAttributeKeys() interface method - ClickHouseSearchIndex implementation using arrayJoin(JSONExtractKeys) - SearchController /attributes/keys endpoint - useAttributeKeys() React Query hook - buildSearchData includes attribute keys as 'attribute' category items Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,22 @@ export function useExecutionStats(
|
||||
});
|
||||
}
|
||||
|
||||
export function useAttributeKeys() {
|
||||
return useQuery({
|
||||
queryKey: ['search', 'attribute-keys'],
|
||||
queryFn: async () => {
|
||||
const token = (await import('../../auth/auth-store')).useAuthStore.getState().accessToken;
|
||||
const { config } = await import('../../config');
|
||||
const res = await fetch(`${config.apiBaseUrl}/search/attributes/keys`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (!res.ok) throw new Error('Failed to load attribute keys');
|
||||
return res.json() as Promise<string[]>;
|
||||
},
|
||||
staleTime: 60_000,
|
||||
});
|
||||
}
|
||||
|
||||
export function useSearchExecutions(filters: SearchRequest, live = false) {
|
||||
const liveQuery = useLiveQuery(5_000);
|
||||
return useQuery({
|
||||
|
||||
Reference in New Issue
Block a user