ISolrOperations.RemoveDocsByFieldName

Fore Syntax

RemoveDocsByFieldName(Core: ISolrSearchEngineCore; FieldName: String; Values: Array): Boolean;

Fore.NET Syntax

RemoveDocsByFieldName(Core: Prognoz.Platform.Interop.BISearch.ISolrSearchEngineCore; FieldName: String; Values: Array): Boolean;

Parameters

Core. The Solr instance which is under work.

FieldType. Field name by which documents should be removed.

Values. Array of indexed values.

Description

The RemoveDocsByFieldName method removes the Apach Solr documents linked to the specified field and where specified indexed values are stocked.

Comments

The field name used to remove documents is case-sensitive.

The method returns True, if removing was successful and False if removing is impossible due to some reasons.

List of the Solr instances can be get in the ISolrSearchEngineService.Cores property.

Fore Example

Sub UserProc;
Var
    MB: IMetabase;
    SharedParams: ISharedParams;
    SearchEngine: ISolrSearchEngineService;
    Core: ISolrSearchEngineCore;
    Operations: ISolrOperations;
    Arr: Array;
Begin
    MB := MetabaseClass.Active;
    SharedParams := MB.SpecialObject(MetabaseSpecialObject.SharedParams).Bind As ISharedParams;
    SearchEngine := SharedParams.SearchEngine As ISolrSearchEngineService;
    Core := SearchEngine.Cores.Item(0);
    Arr := New Variant[1];
    Arr[0] := "Cube";
    Operations := New SolrOperations.Create;
    Operations.RemoveDocsByFieldName(Core, "name", Arr);  
End Sub UserProc;

On executing the example the Solr documents which are linked with the name field and which contain the Cube indexed value will be removed.

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();
    Arr: Array = New Object[1];
Begin
    MB := Params.Metabase;
    SharedParams := MB.SpecialObject[MetabaseSpecialObject.msoSharedParams].Bind() As ISharedParams;
    SearchEngine := SharedParams.SearchEngine As ISolrSearchEngineService;
    Core := SearchEngine.Cores.Item[0];
    Arr[0] := "Cube";
    Operations.RemoveDocsByFieldName(Core, "name", Arr);
End Sub;

See also:

ISolrOperations