diff --git a/cameleer3-server-core/src/main/java/com/cameleer3/server/core/search/SearchService.java b/cameleer3-server-core/src/main/java/com/cameleer3/server/core/search/SearchService.java
index 263193c2..014c606d 100644
--- a/cameleer3-server-core/src/main/java/com/cameleer3/server/core/search/SearchService.java
+++ b/cameleer3-server-core/src/main/java/com/cameleer3/server/core/search/SearchService.java
@@ -1,63 +1,43 @@
package com.cameleer3.server.core.search;
+import com.cameleer3.server.core.storage.SearchIndex;
+import com.cameleer3.server.core.storage.StatsStore;
+
+import java.time.Instant;
import java.util.List;
-/**
- * Orchestrates search operations, delegating to a {@link SearchEngine} backend.
- *
- * This is a plain class (no Spring annotations) -- it lives in the core module
- * and is wired as a bean by the app module configuration. The thin orchestration
- * layer allows adding cross-cutting concerns (logging, caching, metrics) later.
- */
public class SearchService {
- private final SearchEngine engine;
+ private final SearchIndex searchIndex;
+ private final StatsStore statsStore;
- public SearchService(SearchEngine engine) {
- this.engine = engine;
+ public SearchService(SearchIndex searchIndex, StatsStore statsStore) {
+ this.searchIndex = searchIndex;
+ this.statsStore = statsStore;
}
- /**
- * Search for route executions matching the given criteria.
- */
public SearchResult search(SearchRequest request) {
- return engine.search(request);
+ return searchIndex.search(request);
}
- /**
- * Count route executions matching the given criteria.
- */
public long count(SearchRequest request) {
- return engine.count(request);
+ return searchIndex.count(request);
}
- /**
- * Compute aggregate execution stats (P99 latency, active count).
- */
- public ExecutionStats stats(java.time.Instant from, java.time.Instant to) {
- return engine.stats(from, to);
+ public ExecutionStats stats(Instant from, Instant to) {
+ return statsStore.stats(from, to);
}
- /**
- * Compute aggregate execution stats scoped to specific routes and agents.
- */
- public ExecutionStats stats(java.time.Instant from, java.time.Instant to,
- String routeId, List agentIds) {
- return engine.stats(from, to, routeId, agentIds);
+ public ExecutionStats stats(Instant from, Instant to, String routeId, List agentIds) {
+ return statsStore.statsForRoute(from, to, routeId, agentIds);
}
- /**
- * Compute bucketed time-series stats over a time window.
- */
- public StatsTimeseries timeseries(java.time.Instant from, java.time.Instant to, int bucketCount) {
- return engine.timeseries(from, to, bucketCount);
+ public StatsTimeseries timeseries(Instant from, Instant to, int bucketCount) {
+ return statsStore.timeseries(from, to, bucketCount);
}
- /**
- * Compute bucketed time-series stats scoped to specific routes and agents.
- */
- public StatsTimeseries timeseries(java.time.Instant from, java.time.Instant to, int bucketCount,
+ public StatsTimeseries timeseries(Instant from, Instant to, int bucketCount,
String routeId, List agentIds) {
- return engine.timeseries(from, to, bucketCount, routeId, agentIds);
+ return statsStore.timeseriesForRoute(from, to, bucketCount, routeId, agentIds);
}
}