To index and to search in the repository, get preliminary access to the search service. The access can be obtained in two ways:
Using the ISharedParams.SearchEngine property get parameters of the search service used in repository.
Using the ISearchEngineServiceFactory.CreateSearchEngine method create dynamically an instance of the new search service.
Cast the obtained search service to the ISolrSearchEngineService interface:
Var
//...
MB: IMetabase;
SharedParams: ISharedParams;
SearchEngine: ISolrSearchEngineService;
//...
Begin
//...
MB := MetabaseClass.Active;
//Search and indexing parameters specified for repository
SharedParams := MB.SpecialObject(MetabaseSpecialObject.SharedParams).Bind As ISharedParams;
SearchEngine := SharedParams.SearchEngine As ISolrSearchEngineService;
//...
If required, fill in the ISolrSearchEngineService.Cores collection specifying addresses and purpose for the Solr instances, which will be used in processing. Next, the ISearchEngineService.SearchEngineSchema property can be used to get at access to the primary functionality of the search service. Depending on executed work:
The ISearchEngineSchema.ImportExecutor property returns objects used on indexing (available only in Fore.NET).
The ISearchEngineSchema.SearchExecutor property returns the object that is used to search and get result.
See also: