IDocumentWebService InterfaceAnkiro Enterprise Suite Reference Documentation
The IDocumentWebService is used as the main entrypoint to transmit and update data.
Each of the interface methods interacts with a pre-configured data source, as created through the web site or through the management web service.
The service contains methods both for handling incremental data source updates, as well as for fully updating data for the data source.
Examples

Example of the general usage of the document 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 IDocumentWebService

The IDocumentWebService type exposes the following members.

Methods

  NameDescription
Public methodBeginFullUpdate
Creates a new datasource transaction internally, signalling that the set of documents transmitted through subsequent calls to ProcessDocumentsInFullUpdate contain the full set of documents contained in the underlying external datasource. It is necessary to invoke BeginFullUpdate before calls to ProcessDocumentsInFullUpdate. At the same time, BeginFullUpdate should only be used in conjunction with the CommitFullUpdate method.
Public methodCommit
Commits changes made through one or more calls to ProcessDocuments/ProcessDocumentsAsync. The process of committing datasource changes makes changes active in the search index. It is not currently possible to rollback changes performed by ProcessDocuments.
Public methodCommitFullUpdate
Commits a previously created datasource transaction, created through BeginFullUpdate. CommitFullUpdate commits changes the same way as the standard Commit method, however when using a datasource transaction an additional extra step is added to the commit procedure;
When committing a full datasource update, any documents belonging to the datasource that were not transmitted through ProcessDocumentsInFullUpdate between the call to BeginFullUpdate and the call to CommitFullUpdate will be removed from the database. This procedure is used in order to support a mechanism for automatically cleaning up stale/removed data, that has been previously added for the datasource, but which no longer exists in the external datasource.
Public methodDeleteDataSourcePathSegment
Deletes a specified subtree from the data source tree, as specified by the foreign id of the path segment to remove. An exception is thrown if the specified path does not exist.
Public methodGetDataSourcePathSegment
Retrieves a segment or a subtree of a data source path tree, as identified by the foreign id of the subtree to return.
Public methodGetDataSourcePathSegmentDocumentCounts
Public methodGetDataSourcePathSegmentRules
Retrieves the data source rules for a specified path segment, as identified by the foreign id of the path segment.
Public methodGetDataSourcePathSegmentTree
Retrieves the data source path tree of the specified data source.
Public methodGetDataSourceRules
Retrieves all data source rules for a specified data source.
Public methodGetDataSourceSidMap
Retrieves active data source user and role information for a specific data source, as updated through the SynchronizeDataSourceSidMap method.
Public methodGetDocument
Retrieves information about a specified document as identified by a data source uri.
Public methodGetDocuments
Retrieves information about a set of documents associated with a specific data source.
Public methodGetDocumentsByPath
Retrieves information about a set of documents associated with a specific data source. Retrieved documents are limited to the set of documents that are contained within a specified part of the data source path segment tree.
Public methodGetDocumentsByUri
Retrieves information about a specified set of documents as specified by a set of data source uris.
Public methodGetDocumentTermBindingLists
Retrieves the collection of term bindings associated with a list of data source documents, as identified by their database id.
Public methodGetDocumentTermBindings
Retrieves the set of term bindings associated with a specific document, as identified by a document database id.DocumentTermBindingData
Public methodGetDocumentTermBindingsByUri
Retrieves the set of term bindings associated with a specific document, as identified by a document database id.DocumentTermBindingData
Public methodGetPluginConfiguration
Retrieves the plugin configuration data for a specified data source.
Public methodParseFileData
Provides convenience access to the internal parser of Ankiro Suite. The ParseFileData method can be used to parse binary file data in a document format supported by an installed IFilter implementation installed on the Ankiro Suite website server.
Public methodParseHtmlData
Provides convience access to the internal html parser of Ankiro Suite. The ParseHtmlData method can be used to parse general html data into a string representation of the text elements of the html content passed to the method.
Public methodProcessDocuments
Processes one or more DocumentData entries for a specified data source. The method accepts both DocumentData and DocumentDataUpdate entries, allowing both for adding/updating documents, as well as deleting them, as a reflection of changes to the underlying external data store. Changes made to document data does not take effect until an invocation of Commit has been made.
Public methodProcessDocumentsAsync
This method does the same as ProcessDocuments, but processing is carried out asynchronously. Please refer to the documentation for the ProcessDocuments method for more details.
Public methodProcessDocumentsInFullUpdate
Processes documents within a datasource transaction. Datasource transactions are created/managed by Ankiro Suite, and are persisted in the Ankiro Suite database, but datasource transactions are not reflected in the external service interface.
However, when processing a set of documents within an active datasource transaction, processed documents are marked as belonging to the active datasource transaction, allowing a subsequent call to CommitFullUpdate to automatically determine whether other (non-processed) documents should be automatically pruned from the search index upon commit. Please refer to the documentation for the CommitFullUpdate method for more details.
Public methodProcessDocumentsInFullUpdateAsync
Processes documents within a datasource transaction. Datasource transactions are created/managed by Ankiro Suite, and are persisted in the Ankiro Suite database, but datasource transactions are not reflected in the external service interface.
However, when processing a set of documents within an active datasource transaction, processed documents are marked as belonging to the active datasource transaction, allowing a subsequent call to CommitFullUpdate to automatically determine whether other (non-processed) documents should be automatically pruned from the search index upon commit. Please refer to the documentation for the CommitFullUpdate method for more details.
This method is identical to the ProcessDocumentsInFullUpdate method, except that the method returns immediately, and carries out document processing asynchronously.
Public methodProcessIndexingCommands
Processes a sequence of sequential indexing context commands, allowing for batching of multiple document service operations in a single roundtrip.
Public methodPruneDocuments
Removes documents from the data source that are not included in the set of document uris specified by 'documentUris'. Use this method when updating a data source, where it is desired to use information about pre-existing data source documents to remove documents, that no longer exists in the remote repository. The following operation is carried out by the method: 1) Determine which documents are currently registered for the data source. 2) Determine which of the documents are not included in the 'documentUris' set. 3) Invoke ProcessDocuments with a DocumentUpdate action = Remove for each of the documents that are to filtered out by the pruning operation, resulting in the documents being deleted from the data source. Please note that usage of PruneDocuments is only recommended for complex scenarios. In many cases, using BeginFullUpdate/ProcessDocumentsInFullUpdate/CommitFullUpdate may be used to automate handling of data source pruning.
Public methodPruneDocumentsByPath
Removes documents from the data source for a given path segment that are not included in the set of document uris specified by 'documentUris'. Use this method when updating a data source containing path segments, where it is desired to use information about pre-existing data source documents to remove documents from the path location of the data source that no longer exists in the remote repository. The following operation is carried out by the method: 1) Determine which documents are currently registered as belonging to the specified path segment (non-recursively). 2) Determine which of the documents are not included in the 'documentUris' set. 3) Invoke ProcessDocuments with a DocumentUpdate action = Remove for each of the documents that are to filtered out by the pruning operation, resulting in the documents being deleted from the data source. Please note that usage of PruneDocumentsByPath is only recommended for complex scenarios. In many cases, using BeginFullUpdate/ProcessDocumentsInFullUpdate/CommitFullUpdate may be used to automate handling of data source pruning.
Public methodResetDataSourceSecurityData
Resets (deletes) all stored security information for a specified data source, thus disabling security processing for a given data source. Executing this method results in all security information as well as all document access rules to be deleted, for the specified data source.
Public methodSetDataSourcePathSegmentRules
Replaces the data source rules for a specified path segment, as identified by the foreign id of the path segment.
Public methodSetDataSourceRules
Completely replaces the set of data source rules for a specified data source.
Public methodSynchronizeDataSourcePathSegmentTree
Completely replaces the data source path tree for a specified data source with the tree information passed to the method. Existing path segments that are not included in the updated path tree are removed, including any path segment rules that were associated with them. The method does not update rules that are passed to the method. However, rules that exists on path segments that are not removed, are not affected by the operation. It is legal to call the method with a null parameter. Calling the method with an empty (null) tree removes all path segments from the data source.
Public methodSynchronizeDataSourceSidMap
Imports and synchronizes security principal information for a specific data source. The purpose of this method is to provide the ability to update user and role information in a way that does not require re-indexing data source content. This method should be invoked by data source connector implementations that support security, when user or role information/membership changes.
Public methodSynchronizeDocumentAclsGlobal
Synchronizes document Access Control List (ACL) information across all data sources, resynchronizing search server nodes with updated information from the database. This method is invoked internally by Ankiro Suite, and is therefore primarily provided for diagnostic scenarios.
Public methodUpdateDataSourcePathSegment
Updates a specific path segment in the data source tree, non-recursively. If the specified path segment does not exist, but the parent exists, the segment is added to the tree of the parent segment. If the parent does not exist, an exception will be thrown.
Public methodUpdateDataSourcePathSegmentTree
Updates a subtree of the data source path tree recursively. If the subtree does not exist, but the parent exists, the subtree is added to the tree of the parent segment. If the parent does not exist, an exception will be thrown. Existing path segments that are not included in the updated path tree are removed, including any path segment rules that were associated with them. The method does not update rules that are passed to the method. However, rules that exists on path segments that are not removed, are not affected by the operation.
Public methodUpdateDocumentTermBindings
Updates the set of term bindings registered for a specific document.
Public methodUpdateDocumentTermBindingsByUri
Updates the set of term bindings registered for a specific document.
Public methodUpdatePluginConfiguration
Updates the plugin configuration for a specified data source.
Top
See Also