IMbObjectsImportContext.Keys

Fore.NET Syntax

Keys: Array;

Description

The Keys property determines a keys array of indexed repository objects.

Fore Example

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

Fore.NET Example

Executing the example requires that the repository contains objects with the REGIONS_DATA and CITY_DATA identifiers. The settings for indexing and search in Russian are determined in the repository itself.

Imports Prognoz.Platform.Interop.BISearch;
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: IMbObjectsImportContext;
    SolrContext: ISolrImportContext;
    Locales: Array = New Integer[1] = [LocaleCodeID.lcidRussian As Integer];
    ObjectKeys: Array Of UInteger;
Begin
    MB := Params.Metabase;
    //Search and indexing parameters specified for repository
    SharedParams := MB.SpecialObject[MetabaseSpecialObject.msoSharedParams].Bind() As ISharedParams;
    SearchEngine := SharedParams.SearchEngine As ISolrSearchEngineService;
    Schema := SearchEngine.SearchEngineSchema As ISolrSearchEngineSchema;
    //Indexing parameters
    ImportExecutor := Schema.ImportExecutor[SearchEngineTargetType.settMbObject];
    ImportContext := ImportExecutor.CreateContext() As IMbObjectsImportContext;
    SolrContext := ImportContext As ISolrImportContext;
    SolrContext.CleanType := SolrImportCleanType.sictNone;
    SolrContext.Locales := Locales;
    //Indexed objects
    ObjectKeys := New UInteger[2];
    ObjectKeys[0] := MB.GetObjectKeyById("REGIONS_DATA");
    ObjectKeys[1] := MB.GetObjectKeyById("CITY_DATA");
    ImportContext.Keys := ObjectKeys;
    //Indexing
    ImportExecutor.Import(ImportContext);
End Sub;

On executing the example the context required for repository objects metadata indexing will be created. The language used for indexing will be determined in the settings, and indexed objects will be set. After all settings are determined, object metadata will be indexed.

See also:

IMbObjectsImportContext