FillSchemaOptions(Type: SearchEngineTargetType): Boolean;
FillSchemaOptions(Type: Prognoz.Platform.Interop.BISearch.SearchEngineTargetType): Boolean;
Type. Purpose of the Solr instance, for which it is necessary to fill in the fields list.
The FillSchemaOptions method fills in the fields list according to the settings determined in configuration file for the current Solr instance.
Because of the absence of direct access to the Apache Solr configuration files from Fore, to change the fields list, edit Apache Solr configuration files manually. For details about list modification see the Setting Up Desktop Application > Fields subsection.
The FillSchemaOptions method enables the user to synchronize the fields list in repository settings according to the fields list from configuration file. If parameters of required custom fields are known, they can be added to the collection using the ISolrFields.AddField method.
Only SearchEngineTargetType.SourceData and SearchEngineTargetType.MbObject can be used as the Type parameter value.
It is supposed that the repository is set up to work with search service based on Apache Solr. Add links 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;
//Synchronize 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.
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;
//Synchronize custom fields lists
Schema.FillSchemaOptions(SearchEngineTargetType.settSourceData);
Schema.FillSchemaOptions(SearchEngineTargetType.settMbObject);
//Save
SharedParams.SearchEngine := SearchEngine;
(SharedParams As IMetabaseObject).Save();
End Sub;
See also: