IImportExecutor.Import

Fore.NET Syntax

Import(Context: Prognoz.Platform.Interop.BISearch.ISearchEngineImportContext);

Parameters

Context. Context with indexing parameters.

Description

The Import method indexes data sources.

Comments

On indexing required documents are created and indexing data is saved in it where the search service is implemented.

Fore Example

IMPORTANT. Because of the existing features of the Fore language implementation and use of multi-thread mode on indexing, indexing with code on the Fore language is not supported. Develop on the Fore.NET language.

Fore.NET Example

Executing the example requires that the repository contains a parametric standard cube with the STD_CUBE identifier. Two parameters with the YEAR_START and YEAR_FINISH identifiers are created and set up in cube to control nested objects. In the repository settings for indexing and search in Russian are determined.

Imports Prognoz.Platform.Interop.BISearch;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.ForeSystem;
Imports Prognoz.Platform.Interop.KeFore;
Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    SharedParams: ISharedParams;
    SearchEngine: ISolrSearchEngineService;
    Schema: ISolrSearchEngineSchema;
    ImportExecutor: IImportExecutor;
    ImportContext: ISourceDataImportContext;
    SolrContext: ISolrImportContext;
    Locales: Array = New Integer[1] = [LocaleCodeID.lcidRussian As Integer];
    MObj: IMetabaseObject;
    Cube: ICubeModel;
    ParamValues: IMetabaseObjectParamValues;
    SourceInfo: ISourceDataImportInfo;
Begin
    MB := Params.Metabase;
    //Parameters of search and indexing set for repository
    SharedParams := MB.SpecialObject[MetabaseSpecialObject.msoSharedParams].Bind() As ISharedParams;
    SearchEngine := SharedParams.SearchEngine As ISolrSearchEngineService;
    Schema := SearchEngine.SearchEngineSchema As ISolrSearchEngineSchema;
    //Indexing parameters
    Schema.ImportProcessOptions.NeedSmartSearch := False;
    ImportExecutor := Schema.ImportExecutor[SearchEngineTargetType.settSourceData];
    ImportContext := ImportExecutor.CreateContext() As ISourceDataImportContext;
    SolrContext := ImportContext As ISolrImportContext;
    SolrContext.CleanType := SolrImportCleanType.sictSpecified;
    SolrContext.Locales := Locales;
    //Object being indexed
    MObj := MB.ItemById["STD_CUBE"].Bind();
    Cube := MObj As ICubeModel;
    SourceInfo := ImportContext.SourceInfos.Add(Cube);
    SourceInfo.DestinationInfos.Add(Cube.Destinations.DefaultDestination);
    ParamValues := MObj.Params.CreateEmptyValues();
    ParamValues.FindById("YEAR_START").Value := 2000;
    ParamValues.FindById("YEAR_FINISH").Value := 2010;
    SourceInfo.Params := ParamValues;
    //Indexing
    ImportExecutor.Import(ImportContext);
End Sub;

On executing the example the context required for indexing of data source dimension elements will be created. In settings the language used for indexation will be specified and a source will be added. For the source, parameter values which will be used on opening to get list of dimension elements will be determined. After determination of all settings the indexing will be executed. If indexing was already performed for the specified source, the search index will be preliminary cleared for this source.

See also:

IImportExecutor