The management service is used as the main entrypoint to manipulate the primary entities of an Ankiro Suite installation.
General example of use of the management service:
Namespace: Ankiro.SearchServer.Web.ServicesExamples
using System; using System.Collections.Generic; using System.Linq; using Ankiro.SearchServer.Data; namespace Ankiro.Suite.Client.IndexingSample { public class Program { static void Main(string[] args) { var program = new Program(); program.Run(); } private readonly ManagementService.ManagementWebServiceClient _managementService; private readonly DocumentService.DocumentWebServiceClient _documentService; private readonly DataSourceData _dataSource; private Program() { _dataSource = new DataSourceData { Name = "Sample Datasource" }; var clientFactory = ClientFactory.CreateDefaultClientFactory(new Uri(System.Configuration.ConfigurationManager.AppSettings["AnkiroSuiteLocation"])); _managementService = clientFactory.CreateManagementServiceClient(); _documentService = clientFactory.CreateDocumentServiceClient(); } private void Run() { var dataSource = _managementService.GetDataSourceByName(_dataSource.Name) ?? CreateDataSource(); SetupIndex(dataSource); IndexSampleData(dataSource); DeleteDocument(dataSource, "1"); } private void DeleteDocument(DataSourceData dataSource, string uri) { _documentService.ProcessDocuments(dataSource.Id, new[] { new DocumentData { Uri = uri, Action = DocumentAction.Remove } }); _documentService.Commit(dataSource.Id); } private void IndexSampleData(DataSourceData dataSource) { _documentService.ProcessDocuments(dataSource.Id, CreateSampleDocuments().ToArray()); _documentService.Commit(dataSource.Id); } private void SetupIndex(DataSourceData dataSource) { Console.WriteLine("DataSource id: " + dataSource.Id); var exisingIndex = _managementService.GetIndexByName(dataSource.Name); if (exisingIndex != null) return; var newIndex = _managementService.CreateIndexBasedOnDataSource(dataSource.Id); Console.WriteLine("Index created based on datasource. ServerIndex id: " + newIndex.Id); } private DataSourceData CreateDataSource() { _dataSource.Properties = new List<DataSourcePropertyData> { new DataSourcePropertyData { Name = "Title", Type = IndexPropertyType.ShortText, DefaultValue = "No title", Sortable = true, ItemListProperty = false, }, new DataSourcePropertyData { Name = "Text" , Type = IndexPropertyType.Text , Sortable = false, ItemListProperty = false,}}; return _managementService.CreateDataSource(_dataSource); } private static IEnumerable<DocumentData> CreateSampleDocuments() { var documents = new List<DocumentData> { new DocumentData { Uri = "1", FriendlyUri = String.Format("http://mysite/showDocumentById?id={0}", "1"), Properties = new List<DocumentPropertyData>( new[]{ new DocumentPropertyData{Name = "Title",Value = "Document Title"}, new DocumentPropertyData{Name = "Text",Value = "Document Text"} }), Language = "da", }, new DocumentData { Uri = "2", FriendlyUri = String.Format("http://mysite/showDocumentById?id={0}", "2"), Properties = new List<DocumentPropertyData>( new[]{ new DocumentPropertyData{Name = "Title",Value = "Document Title 2"}, new DocumentPropertyData{Name = "Text",Value = "Document Text 2"} }), Language = "da", } }; return documents; } } }
Assembly: Ankiro.SearchServer.Web (in Ankiro.SearchServer.Web.dll) Version: 1.13.770.19253 (1.13.770.19253)
Syntax
The IManagementWebService type exposes the following members.
Methods
Name | Description | |
---|---|---|
![]() | AssociateIndexWithSearchServer |
Creates an association between a specified serverindex and a specified search server node. Indexes require that at least
one search server is associated with it, for indexing to work. This is the case because search server nodes are used as
the underlying repository for indexed documents. Associating more than one search server node with an index enables
automatic distribution of indexed documents, increasing scalability and search performance.
|
![]() | ClearSearchResultCache |
Clears the search result cache for a specified search profile. If -1 is passed as identifier, the global search result cache is cleared.
This method is useful in cases where e.g. a major document update has taken place. The method is invoked automatically by the
'Clear search result cache' scheduled task.
|
![]() | CompactIndex |
Optimizes and compacts the underlying index files on associated servers for performance reasons. Each index update operation,
i.e. a DocumentWebService.ProcessDocuments() / DocumentWebService.Commit() cycle, creates an incremental physical index file
on each associated search server. Searching multiple incremental index files incurs a small overhead, which may be alleviated
by manually compacting the index. However, this process is also carried out automatically by each search server node
based on configuration settings.
|
![]() | CreateDataSource |
Creates a new data source based on the specified information.
|
![]() | CreateDataSourceFromLegacyXml |
Creates a new data source based on a legacy schema definition.
|
![]() | CreateIndex |
Creates and persists an index based on an index definition.
|
![]() | CreateIndexBasedOnDataSource |
Creates and persists an index based on a specified datasource. An exception is thrown if the specified datasource does not exist.
|
![]() | CreateSearchProfile |
Creates a new search profile and returns information about the persisted search profile.
|
![]() | CreateSearchProfileBasedOnIndex |
Creates a new search profile based on an existing index.
|
![]() | CreateSearchServer |
Creates and registers a connection to a new search server node, based on specified configuration information.
|
![]() | GetAllDataSources |
Returns information about all data sources existing in the installation.
|
![]() | GetAllIndexes |
Returns information about all indexes that exist in the installation.
|
![]() | GetAllSearchProfiles |
Returns information about all search profiles existing in the installation.
|
![]() | GetAllServers |
Returns information about all Ankiro search server nodes registered in the installation.
|
![]() | GetDataSource |
Returns information about an existing data source based on a data source id. Null is returned if the specified datasource
does not exist.
|
![]() | GetDataSourceByName |
Returns information about an existing data source based on a data source name. Null is returned if the specified datasource
does not exist.
|
![]() | GetIndex |
Returns index information based on an index id, or null if the specified index does not exist.
|
![]() | GetIndexByName |
Returns index information based on an index name, or null if the specified index does not exist.
|
![]() | GetSearchProfile |
Returns information about an existing search profile based on an id. Null is returned if the specified search profile id does not exist.
|
![]() | GetSearchProfileByName |
Returns information about an existing search profile by name. Null is returned if the specified search profile does not exist.
|
![]() | GetServer |
Returns search server information about a specified search server by id. Null is returned if the specified search server instance
does not exist.
|
![]() | PropagateDataSourcePropertiesToIndex |
Propagates data source properties between the specified data source and its associated server index.
The method synchronizes the schema of the associated server index with the schema definition of the data source,
creating/modifying/deleting server index properties on the server index that differ compared to the schema of
the data source.
|
![]() | RedistributeIndex |
Reconfigures the partitioning of a search index, based on an updated set of search server nodes.
Any documents previously added to the index are redistributed.
The method does not return before the index has been redistributed, which may take several minutes or hours depending
on the size of the index.
|
![]() | RemoveDataSource |
Permanently removes a data source by id. All documents and security information will be permanently removed.
|
![]() | RemoveDataSourceDocuments |
Permanently removes all documents associated with a data source.
|
![]() | RemoveIndex |
Permanently removes an index based on an index id. Any datasource(s) or searchprofile(s) associated with the removed index are
detached from the index, but are otherwise left intact.
|
![]() | RemoveSearchProfile |
Permanently removes a search profile by id.
|
![]() | RemoveSearchServer |
Permanently removes a search server node registration. This method fails if any indexes are still associated with the
search server node and have documents indexed.
|
![]() | UpdateDataSource |
Updates information about a pre-existing data source based on updated information.
|
![]() | UpdateIndex |
Updates an existing index based on an updated index definition.
|
![]() | UpdateSearchProfile |
Updates an existing search profile based on updated information.
|
![]() | UpdateSearchServer |
Updates information about an already existing search server node.
|
See Also