UNPKG

pulse-ai-utils

Version:

Utility functions and helpers for AI-powered applications

77 lines (76 loc) 2.13 kB
import { Firestore } from '@google-cloud/firestore'; import { SupabaseClient } from '@supabase/supabase-js'; import { LocationService } from './location-service'; export interface GeoSearchOptions { type?: string; initialRadius?: number; maxRadius?: number; minResults?: number; limit?: number; includeEmbeddings?: boolean; } export interface GeoSearchResult { id: string; title: string; description?: string; type: string; primary_area: string; locations?: any[]; primary_location?: { lat: number; lng: number; }; distance_miles: number; relevance_score: number; data?: any; content_embedding?: number[]; [key: string]: any; } export interface GeoSearchResponse { results: GeoSearchResult[]; searchRadius: number; totalFound: number; searchLocation?: { lat: number; lng: number; }; } export declare class GeoSearchService { private firestoreDb; private supabaseClient; private locationService; private useSupabase; private progressiveRadii; private minResults; constructor(options?: { firestoreDb?: Firestore; supabaseClient?: SupabaseClient; locationService?: LocationService; useSupabase?: boolean; minResults?: number; }); /** * Search for content near a geographic location */ searchNearby(userLat: number, userLng: number, options?: GeoSearchOptions): Promise<GeoSearchResponse>; /** * Search by area name */ searchByArea(areaId: string, options?: GeoSearchOptions): Promise<GeoSearchResponse>; /** * Search near multiple locations */ searchMultiLocation(locations: Array<{ lat: number; lng: number; relevance?: number; }>, options?: GeoSearchOptions): Promise<GeoSearchResponse>; /** * Firestore search implementation */ private searchFirestoreByRadius; /** * Get content by IDs with location enrichment */ getContentByIds(ids: string[], userLat?: number, userLng?: number): Promise<GeoSearchResult[]>; }