GetPhraseAnalysisByFieldType(Core: ISolrSearchEngineCore; FieldType: String; Phrase: String): Variant;
Core. Solr instance, which is under work.
FieldType. Type of the field used for analysis.
Phrase. Phrase under analysis.
The GetPhraseAnalysisByFieldType method analyzes the specified phrase by field type and returns the array containing a set of synonyms.
The list of the Solr instances can be obtained in the ISolrSearchEngineService.Cores property.
It is supposed that the repository is set 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;
Core: ISolrSearchEngineCore;
Operations: ISolrOperations;
Result, v: Variant;
Arr: Array;
Begin
MB := MetabaseClass.Active;
SharedParams := MB.SpecialObject(MetabaseSpecialObject.SharedParams).Bind As ISharedParams;
SearchEngine := SharedParams.SearchEngine As ISolrSearchEngineService;
Core := SearchEngine.Cores.Item(0);
Operations := New SolrOperations.Create;
Result := Operations.GetPhraseAnalysisByFieldType(Core, "synonym_searcher", "Russian Federation");
Arr := Result As Array;
For Each v In arr Do
Debug.WriteLine(v);
End For;
End Sub UserProc;
On executing the example the specified phrase will be analyzed by the field with the synonym_searcher value. The obtained synonymous words will be displayed in the development environment console.
See also: