Interface IKeywordSearchService
Represents the keyword search API service.
Namespace: Relativity.Testing.Framework.Api.Services
Assembly: Relativity.Testing.Framework.Api.dll
Syntax
public interface IKeywordSearchService
Examples
IKeywordSearchService _keywordSearchService = relativityFacade.Resolve<IKeywordSearchService>();
Methods
| Improve this Doc View SourceCreate(Int32, KeywordSearch)
Creates the specified KeywordSearch.
Declaration
KeywordSearch Create(int workspaceId, KeywordSearch entity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The ArtifactID of the workspace where you want to add the new KeywordSearch. |
KeywordSearch | entity | The KeywordSearch to create. |
Returns
Type | Description |
---|---|
KeywordSearch | The created KeywordSearch. |
Examples
This shows how to create new keyword search using the control number to search for entities that contain "EXAMPLE_CONTROL_NUMBER", which returns Control Number fields and sorts results in descending order.
int workspaceArtifactID = 1015427;
const string controlNumber = "Control Number";
var keywordSearchToCreate = new KeywordSearch
{
Name = "Keyword Search Name",
SearchCriteria = new CriteriaCollection
{
Conditions = new List<BaseCriteria>
{
new Criteria
{
Condition = new CriteriaCondition(new NamedArtifact { Name = controlNumber }, ConditionOperator.Contains, "EXAMPLE_CONTROL_NUMBER"),
}
}
},
Fields = new[] { new NamedArtifact { Name = controlNumber } },
Sorts = new List<Sort> { new Sort { FieldIdentifier = new NamedArtifact { Name = controlNumber }, Direction = SortDirection.Descending } }
};
KeywordSearch createdKeywordSearch = _keywordSearchService.Create(workspaceArtifactID, keywordSearchToCreate);
|
Improve this Doc
View Source
Delete(Int32, Int32)
Deletes KeywordSearch by ArtifactID.
Declaration
void Delete(int workspaceId, int entityId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The ArtifactID of the workspace where you want to delete the KeywordSearch. |
System.Int32 | entityId | The ArtifactID of the KeywordSearch. |
Examples
int workspaceArtifactID = 1015427;
int keywordSearchArtifactID = 1016786;
_keywordSearchService.Delete(workspaceArtifactID, keywordSearchArtifactID);
|
Improve this Doc
View Source
Get(Int32, Int32)
Gets the KeywordSearch by the specified ArtifactID.
Declaration
KeywordSearch Get(int workspaceId, int entityId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The ArtifactID of the workspace where you want to get KeywordSearch. |
System.Int32 | entityId | The ArtifactID of the KeywordSearch. |
Returns
Type | Description |
---|---|
KeywordSearch | The KeywordSearch entity or null. |
Examples
int workspaceArtifactID = 1015427;
int keywordSearchArtifactID = 1016786;
KeywordSearch keywordSearch = _keywordSearchService.Get(workspaceArtifactID, keywordSearchArtifactID);
|
Improve this Doc
View Source
Get(Int32, String)
Gets the KeywordSearch by the specified name.
Declaration
KeywordSearch Get(int workspaceId, string entityName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The ArtifactID of the workspace where you want to get KeywordSearch. |
System.String | entityName | The name of the KeywordSearch. |
Returns
Type | Description |
---|---|
KeywordSearch | The KeywordSearch entity or null. |
Examples
int workspaceArtifactID = 1015427;
int keywordSearchName = "Existing Keyword Search Name";
KeywordSearch keywordSearch = _keywordSearchService.Get(workspaceArtifactID, keywordSearchName);
|
Improve this Doc
View Source
Query(Int32, String)
Query the KeywordSearches by specified condition.
Declaration
KeywordSearch[] Query(int workspaceId, string condition)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The ArtifactID of the workspace where you want to get KeywordSearch. |
System.String | condition | The condition. |
Returns
Type | Description |
---|---|
KeywordSearch[] | The array of KeywordSearches. |
Examples
This example shows how to query for all keyword searches that has ArtifactID greater than or equal to 1016786.
int workspaceArtifactID = 1015427;
string queryCondition = "'Artifact ID' >= 1016786";
KeywordSearch[] keywordSearches = _keywordSearchService.Query(workspaceArtifactID, queryCondition);
|
Improve this Doc
View Source
Require(Int32, KeywordSearch)
Requires the specified KeywordSearch.
- If [ArtifactID](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.Artifact.html#Relativity_Testing_Framework_Models_Artifact_ArtifactID) property of
entity
has positive value, gets [KeywordSearch](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.KeywordSearch.html) by ArtifactID and updates it. - If [Name](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.NamedArtifact.html#Relativity_Testing_Framework_Models_NamedArtifact_Name) property of
entity
has a value, gets [KeywordSearch](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.KeywordSearch.html) by name and updates it if it exists. - Otherwise creates a new [KeywordSearch](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.KeywordSearch.html) entity.
Declaration
KeywordSearch Require(int workspaceId, KeywordSearch entity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The ArtifactID of the workspace where you want to require KeywordSearch. |
KeywordSearch | entity | The KeywordSearch to require. |
Returns
Type | Description |
---|---|
KeywordSearch | The KeywordSearch entity>. |
Examples
This shows how to update and get keyword search by Require method with Keyword Search entity that has ArtifactID filled.
int workspaceArtifactID = 1015427;
int existingKeywordSearchArtifactID = 1016786;
const string controlNumber = "Control Number";
var keywordSearchToUpdate = new KeywordSearch
{
ArtifactID = 1016786,
Name = "Updated Keyword Search Name",
SearchCriteria = new CriteriaCollection
{
Conditions = new List<BaseCriteria>
{
new Criteria
{
Condition = new CriteriaCondition(new NamedArtifact { Name = controlNumber }, ConditionOperator.Contains, "EXAMPLE_CONTROL_NUMBER"),
}
}
},
Fields = new[] { new NamedArtifact { Name = controlNumber } },
Sorts = new List<Sort> { new Sort { FieldIdentifier = new NamedArtifact { Name = controlNumber }, Direction = SortDirection.Descending } }
};
KeywordSearch updatedKeywordSearch = _keywordSearchService.Require(workspaceArtifactID, keywordSearchToUpdate);
This shows how to update and get keyword search by Require method with Keyword Search entity that has Name filled.
int workspaceArtifactID = 1015427;
const string controlNumber = "Control Number";
var keywordSearchToUpdate = new KeywordSearch
{
Name = "Existing Keyword Search Name",
SearchCriteria = new CriteriaCollection
{
Conditions = new List<BaseCriteria>
{
new Criteria
{
Condition = new CriteriaCondition(new NamedArtifact { Name = controlNumber }, ConditionOperator.Contains, "EXAMPLE_CONTROL_NUMBER"),
}
}
},
Fields = new[] { new NamedArtifact { Name = controlNumber } },
Sorts = new List<Sort> { new Sort { FieldIdentifier = new NamedArtifact { Name = controlNumber }, Direction = SortDirection.Descending } },
SortByRank = true,
Notes = "Updated Keyword Search Notes"
};
KeywordSearch updatedKeywordSearch = _keywordSearchService.Require(workspaceArtifactID, keywordSearchToUpdate);
This shows how to create and get new keyword search by Require method with new Keyword Search entity (without ArtifactID filled and Name that does not match any existing Keyword Search Name in given workspace).
int workspaceArtifactID = 1015427;
const string controlNumber = "Control Number";
var keywordSearchToCreate= new KeywordSearch
{
Name = "New Keyword Search Name",
SearchCriteria = new CriteriaCollection
{
Conditions = new List<BaseCriteria>
{
new Criteria
{
Condition = new CriteriaCondition(new NamedArtifact { Name = controlNumber }, ConditionOperator.Contains, "EXAMPLE_CONTROL_NUMBER"),
}
}
},
Fields = new[] { new NamedArtifact { Name = controlNumber } },
Sorts = new List<Sort> { new Sort { FieldIdentifier = new NamedArtifact { Name = controlNumber }, Direction = SortDirection.Descending } },
SortByRank = true,
Notes = "Keyword Search Notes"
};
KeywordSearch createdKeywordSearch = _keywordSearchService.Require(workspaceArtifactID, keywordSearchToCreate);
|
Improve this Doc
View Source
Update(Int32, KeywordSearch)
Updates the specified KeywordSearch.
Declaration
void Update(int workspaceId, KeywordSearch entity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The ArtifactID of the workspace where you want to update the KeywordSearch. |
KeywordSearch | entity | The KeywordSearch to update. |
Examples
int workspaceArtifactID = 1015427;
int keywordSearchName = "Existing Keyword Search Name";
KeywordSearch keywordSearchToUpdate = _keywordSearchService.Get(workspaceArtifactID, keywordSearchName);
keywordSearchToUpdate.Name = "Updated Keyword Search Name";
keywordSearchToUpdate.Notes = "Keyword Search Notes";
_keywordSearchService.Update(workspaceArtifactID, keywordSearchToUpdate);