ISolrSearchEngineService.Cores

Fore Syntax

Cores: ISolrSearchEngineCores;

Fore.NET Syntax

Cores: Prognoz.Platform.Interop.BISearch.ISolrSearchEngineCores;

Description

The Cores property returns the Solr instances collection.

Fore Example

It is supposed that the repository is set up to work with search service based on Apache Solr. Add links to the BISearch, Fore, Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    SharedParams: ISharedParams;
    SearchEngine: ISolrSearchEngineService;
    Cores: ISolrSearchEngineCores;
    Core: ISolrSearchEngineCore;
    i: Integer;
Begin
    MB := MetabaseClass.Active;
    //Get search and indexing parameters
    SharedParams := MB.SpecialObject(MetabaseSpecialObject.SharedParams).Bind As ISharedParams;
    SearchEngine := SharedParams.SearchEngine As ISolrSearchEngineService;
    Cores := SearchEngine.Cores;
    //View list of available Solr instances
    For i := 0 To Cores.Count - 1 Do
        Core := Cores.Item(i);
        Select Case (Core.Type As Integer)
            Case 0: Debug.Write("Search by metadata. URL: ");
            Case 1: Debug.Write("Search by data. URL: ");
            Case 2: Debug.Write("Search by free dimensions. URL: ");
        End Select;
        Debug.WriteLine(Core.Uri + " (Language identifier: " + Core.Locale.ToString + ')');
    End For;
End Sub UserProc;

After executing the example the list of Solr instances set in the current settings of repository search service will be received. The purpose and the URL of each instance will be displayed in the development environment console.

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.KeFore;
Imports Prognoz.Platform.Interop.Metabase;

Public Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    SharedParams: ISharedParams;
    SearchEngine: ISolrSearchEngineService;
    Cores: ISolrSearchEngineCores;
    Core: ISolrSearchEngineCore;
    i: Integer;
Begin
    MB := Params.Metabase;
    //Get search and indexing parameters
    SharedParams := MB.SpecialObject[MetabaseSpecialObject.msoSharedParams].Bind() As ISharedParams;
    SearchEngine := SharedParams.SearchEngine As ISolrSearchEngineService;
    Cores := SearchEngine.Cores;
    //View list of available Solr instances
    For i := 0 To Cores.Count - 1 Do
        Core := Cores.Item[i];
        Select Case (Core.Type As Integer)
            Case 0: System.Diagnostics.Debug.Write("Search by metadata. URL: ");
            Case 1: System.Diagnostics.Debug.Write("Search by data. URL: ");
            Case 2: System.Diagnostics.Debug.Write("Search by free dimensions. URL: ");
        End Select;
        System.Diagnostics.Debug.WriteLine(Core.Uri + " (Language identifier: " + Core.Locale.ToString() + ')');
    End For;
End Sub;

See also:

ISolrSearchEngineService