You can use the APIs to remove statistical data and to prevent the addition of personally identifiable information (PII) to the search index. For example, you can prevent data that contains an at sign (@) from being indexed.
This feature involves the following APIs.
**Method** | **Description** | **Sample** |
StatisticsGetGDPR | Search GDPR data from statistics. Use to get statistics items that match a query pattern. <br>An extension method of IStatisticsClient. | public static GDPRQueryResult StatisticGetGDPR(this IStatisticsClient client, string query) |
StatisticsDeleteGDPR | Delete GDPR data from statistics. Used to delete all statistics items that match the query pattern. <br>An extension method of IStatisticsClient. | public static GDPRDeleteResult StatisticDeleteGDPR(this IStatisticsClient client, string query) |
In addition, you can use these APIs to prevent PII data from appearing in search query results.
### ITrackSanitizerPatternRepository
**Method** | **Description** | **Sample** |
Add | Add patterns to storage which, in turn, are used to prevent PII data from search query. | string Add(TrackSanitizerPattern pattern)<br>void Add(IEnumerable<TrackSanitizerPattern> patterns) |
Get | Get pattern by Pattern Id from storage | TrackSanitizerPattern Get(string patternId) |
GetAll | Get all patterns from storage | IEnumerable<TrackSanitizerPattern> GetAll() |
Update | Update existing pattern(s) | string Update(TrackSanitizerPattern pattern)<br><br>void Update(IEnumerable<TrackSanitizerPattern> patterns) |
Delete | Delete pattern by Id from storage | void Delete(string patternId) |
DeleteAll | Delete all patterns from storage | void DeleteAll() |
See also [Prevent indexing of PII data](🔗).
### Examples
To retrieve and remove PII data from statistics, you can search for a range of data:
Email including domain name, for example "[email protected]"
Full name, for example "John Doe"
You can prevent sensitive data in a custom search query from being saved to the statistics using a predefined pattern.
When using a wildcard pattern, review these [Microsoft wildcard samples](🔗).
## Search, filter, and delete PII data
Use statistics#Search\_filter\_delete, see [Prevent indexing of PII data](🔗) how to install a sample and verify the deletion.