# Search Store (Full Text)

## Description

Full-text search providers register through `IFlexSearchStore`. Your application code stays provider-agnostic while the selected provider handles indexing and query execution.

## Infrastructure arrangement

When you add a full-text search provider through **Flex Studio**, Flex generates the provider infrastructure and configuration:

1. Provider files under `Infrastructure/Providers/{YourApplication}.DataStoreProviders/Search/{Provider}/`
2. Default configuration under `Application/EndPoints/{YourApplication}.EndPoint.CommonConfigs/AppSettings/DataStores/Search/{Provider}.json`

Flex auto-wires generated Queries/Handlers/Plugins that use `IFlexSearchStore`—you only register the provider.

## Configuration in DI

Register only the provider search store you need.

```csharp
// Pick ONE provider.
services.AddFlexSqlServerSearchStore(configuration);
// services.AddFlexPostgreSqlSearchStore(configuration);
// services.AddFlexElasticsearchStore(configuration);
```

## appsettings.json

Full-text search configuration is read from `FlexBase:DataStores:Search:<Provider>`.

```json
{
  "FlexBase": {
    "DataStores": {
      "Search": {
        "SqlServer": {
          "ConnectionString": "Server=...;Database=...;User Id=...;Password=<store-in-secrets>;TrustServerCertificate=True",
          "TableName": "dbo.Articles",
          "IdColumn": "Id",
          "SearchableColumns": [ "Title", "Body" ]
        }
      }
    }
  }
}
```

## Sample usage ({YourApplication})

```csharp
public class PolicySearch
{
	private readonly IFlexSearchStore _searchStore;

	public PolicySearch(IFlexSearchStore searchStore)
		=> _searchStore = searchStore;

	public Task<IReadOnlyList<PolicySearchDocument>> SearchAsync(string query)
		=> _searchStore.SearchAsync<PolicySearchDocument>(query, take: 25);
}

public class PolicySearchDocument
{
	public string Id { get; set; }
}
```

## Provider pages

* SQL Server: `search-store-full-text/sql-server-full-text-search.md`
* PostgreSQL: `search-store-full-text/postgre-sql-full-text-search.md`
* Elasticsearch: `search-store-full-text/elastic-search.md`

## Provider considerations

* Use full-text search for keyword-based scenarios (known terms, filters, “contains” style queries).
* If you need provider-specific SQL fragments, use `ProviderSqlMap` inside generated plugins/queries.
* For semantic search, use the Vector Store and keep full-text as a complementary filter.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flexbase.in/data-and-providers/data-stores/search-store-full-text.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
