Common/Search/
SearchProvider.rs

1// File: Common/Source/Search/SearchProvider.rs
2// Role: Defines the abstract service trait for workspace-wide search
3// functionality. Responsibilities:
4//   - Provide a contract for performing text searches across the workspace.
5//   - (Future) Provide a contract for file searches (finding files by name).
6
7//! # SearchProvider Trait
8//!
9//! Defines the abstract service trait for performing workspace-wide text and
10//! file searches.
11
12use async_trait::async_trait;
13use serde_json::Value;
14
15use crate::{Environment::Environment::Environment, Error::CommonError::CommonError};
16
17/// An abstract service contract for an environment component that can perform
18/// high-performance text and file searches across the workspace.
19#[async_trait]
20pub trait SearchProvider: Environment + Send + Sync {
21	/// Performs a text search across all workspace folders.
22	///
23	/// # Parameters
24	/// * `QueryValue`: A DTO representing the text search query, including the
25	///   pattern, case sensitivity, etc.
26	/// * `OptionsValue`: A DTO representing search options, such as files to
27	///   include or exclude.
28	///
29	/// # Returns
30	/// A `Result` containing a `Value` that is a JSON array of `FileMatchDTO`s.
31	async fn TextSearch(&self, QueryValue:Value, OptionsValue:Value) -> Result<Value, CommonError>;
32}