

Last date modified: April 15 2025
Processing filters provide functionality to view and select processed documents before publishing them to Relativity. The Processing Filter Manager API exposes methods for programmatically creating, updating, and deleting filters. It supports applying these filters to data and retrieving the filtered data. Additionally, this service exposes helper methods for retrieving filters associated with a data source or available in a specific workspace. For more general information, see Filtering data.
As a sample use case, you may want to implement a simplified processing workflow by programmatically adding complex criteria to filters applied to processing jobs in Relativity. This approach eliminates the need to manually enter filter criteria through the UI, which may be time consuming and error prone. Similarly, you can also use the Processing Filter Manager service to modify the settings on these or other complex filters implemented in your environment.
The Processing Filter Manager service also supports the same functionality through REST. For more information, see Processing Filter Manager (REST).
Review the following information to learn about the methods, classes, and enumerations used by the Processing Filter Manager service.
The Relativity.Processing.Services namespace contains the IProcessingFilterManager interface that exposes the following methods:
Relativity.Processing.Services.Interfaces.DTOs namespace contains the following classes and enumerations used by the Processing Filter Manager API. The following list highlights several of the classes and enumerations in this namespace. For a complete list, see Class library reference in the Class library reference.
Review the following guidelines for working with the Processing Filter Manager API.
Verify that you have access to the workspace where you want make calls to the Processing Filter Manager service.
Use the GetFilterByDataSourceAsync() or GetFiltersAsync() helper methods to get the name, identifier, and type for a filter. See Retrieve processing filters or Retrieve processing filters for a data source.
To create or update a processing filter, use the expression types, operators, and properties supported by the Processing Filter Manager service for this purpose. For more information about expression classes and enumerations, see the Relativity.Processing.Services.Interfaces.DTOs namespace for the Class library reference.
You can find examples of expression types in Create a processing filter.
The following types of expressions are supported:
The Relativity.Processing.Services.Interfaces.DTOs namespace includes the following enumerations for operators supported in expressions:
The Property enumeration provides a list of properties supported for use in expressions.
To create or update a processing filter, you need to create an expression object that is referenced by the request object passed to the CreateExpressionFilterAsync() method.
The following code samples illustrate how to create a request object for each type of expression. For more information, see Filter expressions.
CreateExpressionFilterAsync
1
2
3
4
5
6
7
8
9
10
11
CreateProcessingExpressionFilterRequest request = new CreateProcessingExpressionFilterRequest() {
FilterName = "Hello World Filter Name",
DataSourceIDs = new List<int>{
123
},
Expression = "{\"Type\": \"ProcessingFilterConditionalExpression\", \"Property\": \"ProcessingFileID\", \"Constraint\": \"IsNot\", \"Value\": 123}",
IncludeFamily = true
};
using (IProcessingFilterManager proxy = _servicesMgr.CreateProxy < IProcessingFilterManager > (ExecutionIdentity.CurrentUser)) {
ProcessingFilter filter = await proxy.CreateExpressionFilterAsync(data.WorkspaceId, request).ConfigureAwait(false);
}
Use the ApplyFilterAsync() method to apply a processing filter to a data set. The following code sample illustrates how to instantiate a ApplyProcessingFilterRequest object containing the Artifact ID of the workspace, filter ID, and a job priority. The request object is then passed to the ApplyFilterAsync() method, which returns a job ID.
1
2
3
4
5
6
ApplyProcessingFilterRequest request = new ApplyProcessingFilterRequest() {
Priority = 90
};
using (IProcessingFilterManager proxy = _servicesMgr.CreateProxy<IProcessingFilterManager>(ExecutionIdentity.CurrentUser)) {
long jobId = await proxy.ApplyFilterAsync(data.WorkspaceId, filterID, request).ConfigureAwait(false);
}
To update a processing filter, instantiate an UpdateProcessingExpressionFilterRequest object, and pass it to the UpdateExpressionFilterAsync() method, which returns a a ProcessingFilter object containing the name, identifier, and type of the filter. For more information, see Filter expressions.
1
2
3
4
5
6
7
8
9
10
11
UpdateProcessingExpressionFilterRequest request = new UpdateProcessingExpressionFilterRequest() {
FilterName = "Hello World Filter Name",
DataSourceIDs = new List<int>{
123
},
Expression = "{\"Type\": \"ProcessingFilterConditionalExpression\", \"Property\": \"ProcessingFileID\", \"Constraint\": \"IsNot\", \"Value\": 123}",
IncludeFamily = true
};
using (IProcessingFilterManager proxy = _servicesMgr.CreateProxy<IProcessingFilterManager>(ExecutionIdentity.CurrentUser)) {
ProcessingFilter filter = await proxy.UpdateExpressionFilterAsync(data.WorkspaceId, filterID, request).ConfigureAwait(false);
}
To remove a processing filter, instantiate a DeleteFilterRequest object containing the Artifact ID of the workspace, and the filter ID, and then pass this request to the DeleteFilterAsync() method.
1
2
3
using (IProcessingFilterManager proxy = _servicesMgr.CreateProxy<IProcessingFilterManager>(ExecutionIdentity.CurrentUser)) {
await proxy.DeleteFilterAsync(data.WorkspaceId, filterID).ConfigureAwait(false);
}
After you apply a processing filter, you can use the GetDiscoveredDocumentsAsync() method to retrieve discovered documents.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
GetDiscoveredDocumentsRequest request = new GetDiscoveredDocumentsRequest() {
Expression =
"{\"Type\":\"ConditionalExpression\",\"Property\":\"FileExtension\",\"Constraint\":\"15\",\"Value\":\"European\"}",
StartingPointOfResult = 0,
NumberOfResults = 1,
SortingOptions = new List<SortOption>{
new SortOption() {
Property = Property.FileName,
Order = Ordering.Ascending
}
},
};
using (IProcessingFilterManager proxy = _servicesMgr.CreateProxy<IProcessingFilterManager>(ExecutionIdentity.CurrentUser)) {
ProcessingFilterData response = await proxy.GetDiscoveredDocumentsAsync(data.WorkspaceId, request).ConfigureAwait(false);
}
After you apply a processing filter, you can use the GetDiscoveredDocumentIdsAsync() method to retrieve the Ids of discovered documents.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
GetDiscoveredDocumentsRequest request = new GetDiscoveredDocumentsRequest() {
Expression =
"{\"Type\":\"ConditionalExpression\",\"Property\":\"FileExtension\",\"Constraint\":\"15\",\"Value\":\"European\"}",
StartingPointOfResult = 0,
NumberOfResults = 1,
SortingOptions = new List<SortOption>{
new SortOption() {
Property = Property.ContainerName,
Order = Ordering.Descending
}
},
};
using (IProcessingFilterManager proxy = _servicesMgr.CreateProxy<IProcessingFilterManager>(ExecutionIdentity.CurrentUser)) {
ProcessingFileIdResults results = await proxy.GetDiscoveredDocumentIdsAsync(data.WorkspaceId, request).ConfigureAwait(false);
} }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
GetDiscoveredDocumentListRequest request = new GetDiscoveredDocumentListRequest {
Columns = new List<ExportColumn>{
new ExportColumn {
Header = "Id",
Property = Property.ProcessingFileId
}
},
Expression = string.Empty,
FileIDs = new long[] {
1
}
};
using (IProcessingFilterManager proxy = _servicesMgr.CreateProxy<IProcessingFilterManager>(ExecutionIdentity.CurrentUser)) {
PrepareDiscoveredDocumentListResponse response = await proxy.PrepareDiscoveredDocumentListAsync(data.WorkspaceId, request).ConfigureAwait(false);
} }
After you apply a processing filter, you can use the GetFilterResultAsync() method to retrieve the filtered data.
1
2
3
using (IProcessingFilterManager proxy = _servicesMgr.CreateProxy<IProcessingFilterManager>(ExecutionIdentity.CurrentUser)) {
ProcessingFilterData response = await proxy.GetFilterResultAsync(data.WorkspaceId, filterID, 0, 10).ConfigureAwait(false);
}
You can retrieve all available processing filters for a specific workspace. The following code sample illustrates how to instantiate a GetProcessingFiltersRequest instance with the Artifact ID of a specific workspace. It shows how to call the GetFiltersAsync() method by passing the request object to it. This method returns a ProcessingFilter object, which has properties for the name, identifier, and type of the filter.
List of ProcessingFilter objects
1
2
3
using (IProcessingFilterManager proxy = _servicesMgr.CreateProxy<IProcessingFilterManager>(ExecutionIdentity.CurrentUser)) {
List<ProcessingFilter> filters = await proxy.GetFiltersAsync(data.WorkspaceId).ConfigureAwait(false);
}
You can retrieve processing filters for a specific data source. This method returns a list of ProcessingFilter object, which has properties for the name, identifier, and type of the filter.
1
2
3
4
using (IProcessingFilterManager proxy = _servicesMgr.CreateProxy<IProcessingFilterManager>(ExecutionIdentity.CurrentUser))
{
List<ProcessingFilter> filters = await proxy.GetFiltersByDataSourceAsync(data.WorkspaceId, dataSourceId).ConfigureAwait(false);
}
After you apply a processing filter, you can use the PivotOnDiscoveredDocumentsAsync() method to retrieve filtered discovered documents on pivot.
1
2
3
4
5
6
7
8
9
10
11
GetDiscoveredDocumentsWithPivotOnRequest request = new GetDiscoveredDocumentsWithPivotOnRequest() {
Expression = "{\"Type\" : \"ConditionalExpression\", \"Property\" : \"FileId\", \"Constraint\" : \"IsNot\", \"Value\" : 123}",
PivotOnOption = new PivotOnOption() {
GroupByProperty = Property.ProcessingFileId,
GroupByOrdering = Ordering.Descending,
GroupByCount = 10
}
};
using (IProcessingFilterManager proxy = _servicesMgr.CreateProxy<IProcessingFilterManager>(ExecutionIdentity.CurrentUser)) {
List < GetDiscoveredDocumentsWithPivotOnResponse > response = await proxy.PivotOnDiscoveredDocumentsAsync(data.WorkspaceId, request).ConfigureAwait(false);
}
1
2
3
4
5
6
using (IProcessingFilterManager proxy = _servicesMgr.CreateProxy<IProcessingFilterManager>(ExecutionIdentity.CurrentUser))
using (IKeplerStream download = await proxy.DownloadDiscoveredDocumentListAsync(data.WorkspaceId, downloadGuid).ConfigureAwait(false))
using (Stream stream = await download.GetStreamAsync().ConfigureAwait(false))
using (var localStream = new MemoryStream()) {
await stream.CopyToAsync(localStream).ConfigureAwait(false);
} }
On this page
Why was this not helpful?
Check one that applies.
Thank you for your feedback.
Want to tell us more?
Great!
Additional Resources |
|||
DevHelp Community | GitHub | Release Notes | NuGet |