ISolrSearchEngineSchema.FillSchemaOptions

Fore Syntax

FillSchemaOptions(Type: SearchEngineTargetType): Boolean;

Fore.NET Syntax

FillSchemaOptions(Type: Prognoz.Platform.Interop.BISearch.SearchEngineTargetType): Boolean;

Parameters

Type. Purpose of the Solr instance for which it is necessary to fill in the list of fields.

Description

The FillSchemaOptions method fills in list of fields according to settings which are determined in configuration file for the current Solr instance.

Comments

Because of the absence of direct access to the Apache Solr configuration files from Fore, to change list of fields it is necessary to edit the Apache Solr configuration files manually. More detailed information about list modification you can find in the Setup Desktop Application > Fields».

The FillSchemaOptions method allows to synchronize list of fields in repository settings according to list of fields from configuration file. And if parameters of required custom fields are known, it can be added to collection using the ISolrFields.AddField method.

Only SearchEngineTargetType.SourceData and SearchEngineTargetType.MbObject can be used as the Type parameter value.

Fore Example

It is supposed that the repository is set to work with search service based on Apache Solr. Connect the BiSearch, Fore, Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    SharedParams: ISharedParams;
    SearchEngine: ISolrSearchEngineService;
    Schema: ISolrSearchEngineSchema;
Begin
    MB := MetabaseClass.Active;
    SharedParams := MB.SpecialObject(MetabaseSpecialObject.SharedParams).Edit As ISharedParams;
    SearchEngine := SharedParams.SearchEngine As ISolrSearchEngineService;
    Schema := SearchEngine.SearchEngineSchema As ISolrSearchEngineSchema;
    //Synchronization of custom fields lists
    Schema.FillSchemaOptions(SearchEngineTargetType.SourceData);
    Schema.FillSchemaOptions(SearchEngineTargetType.MbObject);
    //Save
    SharedParams.SearchEngine := SearchEngine;
    (SharedParams As IMetabaseObject).Save;
End Sub UserProc;

On executing the example in search settings and in repository indexing the list of custom fields will be synchronized according to the Solr configuration file.

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 Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    SharedParams: ISharedParams;
    SearchEngine: ISolrSearchEngineService;
    Schema: ISolrSearchEngineSchema;
Begin
    MB := Params.Metabase;
    SharedParams := MB.SpecialObject[MetabaseSpecialObject.msoSharedParams].Edit() As ISharedParams;
    SearchEngine := SharedParams.SearchEngine As ISolrSearchEngineService;
    Schema := SearchEngine.SearchEngineSchema As ISolrSearchEngineSchema;
    //Synchronization of custom fields lists
    Schema.FillSchemaOptions(SearchEngineTargetType.settSourceData);
    Schema.FillSchemaOptions(SearchEngineTargetType.settMbObject);
    //Save
    SharedParams.SearchEngine := SearchEngine;
    (SharedParams As IMetabaseObject).Save();
End Sub;

See also:

ISolrSearchEngineSchema