IManagementWebService InterfaceAnkiro Enterprise Suite Reference Documentation
The management service is used as the main entrypoint to manipulate the primary entities of an Ankiro Suite installation.
Examples

General example of use of the management service:
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;
        }
    }
}

Namespace: Ankiro.SearchServer.Web.Services
Assembly: Ankiro.SearchServer.Web (in Ankiro.SearchServer.Web.dll) Version: 1.13.770.19253 (1.13.770.19253)
Syntax

public interface IManagementWebService

The IManagementWebService type exposes the following members.

Methods

  NameDescription
Public methodAssociateIndexWithSearchServer
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.
Public methodClearSearchResultCache
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.
Public methodCompactIndex
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.
Public methodCreateDataSource
Creates a new data source based on the specified information.
Public methodCreateDataSourceFromLegacyXml
Creates a new data source based on a legacy schema definition.
Public methodCreateIndex
Creates and persists an index based on an index definition.
Public methodCreateIndexBasedOnDataSource
Creates and persists an index based on a specified datasource. An exception is thrown if the specified datasource does not exist.
Public methodCreateSearchProfile
Creates a new search profile and returns information about the persisted search profile.
Public methodCreateSearchProfileBasedOnIndex
Creates a new search profile based on an existing index.
Public methodCreateSearchServer
Creates and registers a connection to a new search server node, based on specified configuration information.
Public methodGetAllDataSources
Returns information about all data sources existing in the installation.
Public methodGetAllIndexes
Returns information about all indexes that exist in the installation.
Public methodGetAllSearchProfiles
Returns information about all search profiles existing in the installation.
Public methodGetAllServers
Returns information about all Ankiro search server nodes registered in the installation.
Public methodGetDataSource
Returns information about an existing data source based on a data source id. Null is returned if the specified datasource does not exist.
Public methodGetDataSourceByName
Returns information about an existing data source based on a data source name. Null is returned if the specified datasource does not exist.
Public methodGetIndex
Returns index information based on an index id, or null if the specified index does not exist.
Public methodGetIndexByName
Returns index information based on an index name, or null if the specified index does not exist.
Public methodGetSearchProfile
Returns information about an existing search profile based on an id. Null is returned if the specified search profile id does not exist.
Public methodGetSearchProfileByName
Returns information about an existing search profile by name. Null is returned if the specified search profile does not exist.
Public methodGetServer
Returns search server information about a specified search server by id. Null is returned if the specified search server instance does not exist.
Public methodPropagateDataSourcePropertiesToIndex
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.
Public methodRedistributeIndex
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.
Public methodRemoveDataSource
Permanently removes a data source by id. All documents and security information will be permanently removed.
Public methodRemoveDataSourceDocuments
Permanently removes all documents associated with a data source.
Public methodRemoveIndex
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.
Public methodRemoveSearchProfile
Permanently removes a search profile by id.
Public methodRemoveSearchServer
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.
Public methodUpdateDataSource
Updates information about a pre-existing data source based on updated information.
Public methodUpdateIndex
Updates an existing index based on an updated index definition.
Public methodUpdateSearchProfile
Updates an existing search profile based on updated information.
Public methodUpdateSearchServer
Updates information about an already existing search server node.
Top
See Also