Add(Address: String; Type: SearchEngineTargetType; Locale: LocaleCodeID): ISolrSearchEngineCore;
Add(Address: String; Type: Prognoz.Platform.Interop.BISearch.SearchEngineTargetType; Locale: Prognoz.Platform.Interop.ForeSystem.LocaleCodeID): Prognoz.Platform.Interop.BISearch.ISolrSearchEngineCore;
Address. URL of the Solr instance.
Type. Solr instance purpose.
Locale. Solr instance is intended to work with the language having this identifier.
The Add method adds a Solr instance according to the specified parameters.
The URL determined in the Address parameter is case-sensitive.
Sub UserProc;
Var
MB: IMetabase;
SharedParams: ISharedParams;
SearchEngine: ISolrSearchEngineService;
Cores: ISolrSearchEngineCores;
Begin
MB := MetabaseClass.Active;
//Search and indexing parameters specified for repository
SharedParams := MB.SpecialObject(MetabaseSpecialObject.SharedParams).Edit As ISharedParams;
SearchEngine := SharedParams.SearchEngine As ISolrSearchEngineService;
Cores := SearchEngine.Cores;
//Add a Solr 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;
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;
//Search and indexing parameters specified for repository
SharedParams := MB.SpecialObject[MetabaseSpecialObject.msoSharedParams].Edit() As ISharedParams;
SearchEngine := SharedParams.SearchEngine As ISolrSearchEngineService;
Cores := SearchEngine.Cores;
//Add a Solr 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;
On executing the example a new Solr instance that is used to index and search information about elements of the dimensions, which create data slices in Russian, will be added in the search settings.
See also: