ISolrOperations.GetPhraseAnalysisByFieldName

Fore Syntax

GetPhraseAnalysisByFieldName(Core: ISolrSearchEngineCore; FieldName: String; Phrase: String): Variant;

Fore.NET Syntax

GetPhraseAnalysisByFieldName(Core: Prognoz.Platform.Interop.BISearch.ISolrSearchEngineCore; FieldName: String; Phrase: String): Object;

Parameters

Core. Solr instance, which is under work.

FieldName. Name of the field, which is used for analysis.

Phrase. Phrase under analysis.

Description

The GetPhraseAnalysisByFieldName method analyzes the specified phrase by field name and returns the array containing a set of synonyms.

Comments

The list of the Solr instances can be obtained in the ISolrSearchEngineService.Cores property. The field name used for analysis is case-sensitive.

Fore Example

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.GetPhraseAnalysisByFieldName(Core, "name""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 named "name". The obtained synonymous words 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 Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    SharedParams: ISharedParams;
    SearchEngine: ISolrSearchEngineService;
    Core: ISolrSearchEngineCore;
    Operations: ISolrOperations = New SolrOperationsClass();
    Result, v: Object;
    Arr: Array;
Begin
    MB := Params.Metabase;
    SharedParams := MB.SpecialObject[MetabaseSpecialObject.msoSharedParams].Bind() As ISharedParams;
    SearchEngine := SharedParams.SearchEngine As ISolrSearchEngineService;
    Core := SearchEngine.Cores.Item[0];
    Result := Operations.GetPhraseAnalysisByFieldName(Core, "name""Russian Federation");
    Arr := Result As Array;
    For Each v In arr Do
        System.Diagnostics.Debug.WriteLine(v);
    End For;
End Sub;

See also:

ISolrOperations