/**
 * 하이브리드 검색 엔진 팩토리
 * 의존성 주입 및 객체 생성 관리
 */
import { HybridSearchEngine, AdaptiveWeightCalculator, resolveQueryUnifiedEmbeddingForHybridSearch, } from '../algorithms/hybrid-search-engine.js';
import { SearchEngine } from '../algorithms/search-engine.js';
import { SearchResultCombiner } from '../algorithms/search-result-combiner.js';
import { MemoryEmbeddingService } from '../../memory/services/memory-embedding-service.js';
import { VectorSearchEngine } from '../algorithms/vector-search-engine.js';
import { logger } from '../../../shared/utils/logger.js';
class DefaultSearchLogger {
    logSearchStart(searchId, query) {
        logger.debug('하이브리드 검색 시작', { searchId, query: query.query });
    }
    logSearchStep(searchId, step, data) {
        logger.debug(`하이브리드 검색 단계: ${step}`, { searchId, data });
    }
    logSearchComplete(searchId, result, queryTime) {
        logger.info('하이브리드 검색 완료', {
            searchId,
            resultCount: result.total_count,
            queryTime,
        });
    }
    logSearchError(searchId, error, query) {
        logger.error('하이브리드 검색 오류', { searchId, error, query: query.query });
    }
}
export class HybridSearchFactory {
    /**
     * 기본 설정으로 하이브리드 검색 엔진 생성
     */
    static createDefaultEngine(db, embeddingService, options) {
        const textSearchEngine = new SearchEngine();
        const emb = embeddingService ?? new MemoryEmbeddingService();
        const vectorSearchEngine = new VectorSearchEngine();
        const resultCombiner = new SearchResultCombiner();
        const weightCalculator = new AdaptiveWeightCalculator();
        const searchLogger = new DefaultSearchLogger();
        return new HybridSearchEngine(textSearchEngine, emb, vectorSearchEngine, resultCombiner, weightCalculator, searchLogger, resolveQueryUnifiedEmbeddingForHybridSearch(emb), undefined, undefined, options?.rankingWeightsPath);
    }
    /**
     * 의존성 주입으로 하이브리드 검색 엔진 생성
     */
    static createEngine(textSearchEngine, embeddingService, vectorSearchEngine, resultCombiner, weightCalculator, searchLogger) {
        const queryUnified = resolveQueryUnifiedEmbeddingForHybridSearch(embeddingService);
        return new HybridSearchEngine(textSearchEngine, embeddingService, vectorSearchEngine, resultCombiner, weightCalculator, searchLogger, queryUnified);
    }
}
//# sourceMappingURL=hybrid-search.factory.js.map