ISolrSearchEngineCores.Add

Fore Syntax

Add(Address: String; Type: SearchEngineTargetType; Locale: LocaleCodeID): ISolrSearchEngineCore;

Fore.NET Syntax

Add(Address: String; Type: Prognoz.Platform.Interop.BISearch.SearchEngineTargetType; Locale: Prognoz.Platform.Interop.ForeSystem.LocaleCodeID): Prognoz.Platform.Interop.BISearch.ISolrSearchEngineCore;

Parameters

Address. URL address of the Solr instance.

Type. The Solr instance purpose.

Locale. The Solr instance is intended to work with the language having this identifier.

Description

The Add method adds the Solr instance according to the specified parameters.

Comments

URL address determined in the Address parameter is case sensitive.

Fore Example

Sub UserProc;
Var
    MB: IMetabase;
    SharedParams: ISharedParams;
    SearchEngine: ISolrSearchEngineService;
    Cores: ISolrSearchEngineCores;
Begin
    MB := MetabaseClass.Active;
    //Parameters of search and indexing set for repository
    SharedParams := MB.SpecialObject(MetabaseSpecialObject.SharedParams).Edit As ISharedParams;
    SearchEngine := SharedParams.SearchEngine As ISolrSearchEngineService;
    Cores := SearchEngine.Cores;
    //Add the Sorl instance
    Cores.Add("http://localhost:8080/solr-4.4.0/SourceData_ru", SearchEngineTargetType.SourceData, LocaleCodeID.Russian);
    //Save
    SharedParams.SearchEngine := SearchEngine;
    (SharedParams As IMetabaseObject).Save;
End Sub UserProc;

On executing the example a new Solr instance used to index and to search information about elements of dimensions which create data slices in Russian will be added in the search settings.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

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;
    Cores: ISolrSearchEngineCores;
Begin
    MB := Params.Metabase;
    //Parameters of search and indexing set for repository
    SharedParams := MB.SpecialObject[MetabaseSpecialObject.msoSharedParams].Edit() As ISharedParams;
    SearchEngine := SharedParams.SearchEngine As ISolrSearchEngineService;
    Cores := SearchEngine.Cores;
    //Add the Sorl instance
    Cores.Add("http://localhost:8080/solr-4.4.0/SourceData_ru", SearchEngineTargetType.settSourceData, LocaleCodeID.lcidRussian);
    //Save
    SharedParams.SearchEngine := SearchEngine;
    (SharedParams As IMetabaseObject).Save();
End Sub;

See also:

ISolrSearchEngineCores