ISolrSearchEngineService.Cores

Syntax

Cores: ISolrSearchEngineCores;

Description

The Cores property returns the Solr instances collection.

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.

See also:

ISolrSearchEngineService