RemoveDocsByFieldName(Core: ISolrSearchEngineCore; FieldName: String; Values: Array): Boolean;
RemoveDocsByFieldName(Core: Prognoz.Platform.Interop.BISearch.ISolrSearchEngineCore; FieldName: String; Values: Array): Boolean;
Core. Solr instance, which is under work.
FieldType. Field name, by which documents must be removed.
Values. Array of indexed values.
The RemoveDocsByFieldName method removes the Apach Solr documents linked to the specified field and where specified indexed values are stored.
The field name that is used to remove documents is case-sensitive.
The method returns True if removal was successful, and False if removal is impossible due to some reasons.
The list of the Solr instances can be obtained in the ISolrSearchEngineService.Cores property.
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.
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: