Search¶
The Search module provides a generic interface for full-text search with weighted fields, faceted filtering, and highlighted results. Implementations are swapped via DI.
Quick Start¶
using Deepstaging.Effects;
using Deepstaging.Search;
public class Product
{
public string Id { get; set; }
[Searchable]
public string Name { get; set; }
[Searchable(Weight = 0.5)]
public string Description { get; set; }
[Searchable(Filterable = true, Sortable = true)]
public string Category { get; set; }
}
[EffectsModule(typeof(ISearchIndex<Product>))]
public sealed partial class ProductSearchEffects;
The generator produces Eff<RT, A> wrappers for all operations on ISearchIndex<T>.
Features¶
| Feature | Description |
|---|---|
[Searchable] |
Mark properties for indexing with Weight, Filterable, Sortable, Facetable |
| Pagination | Offset / Limit on SearchOptions |
| Facets | Faceted counts by field |
| Highlighting | Highlighted match fragments per hit |
| Effects-native | Eff<RT, T> wrappers via [EffectsModule] |
Interface¶
public interface ISearchIndex<T>
{
Task<SearchResult<T>> SearchAsync(string query, SearchOptions? options = null);
Task IndexAsync(string id, T document);
Task IndexManyAsync(IReadOnlyList<(string Id, T Document)> documents);
Task RemoveAsync(string id);
Task ClearAsync();
}