Telligent Evolution uses Solr for its search functionality by default, but it is possible to replace Solr with a different search service. This document describes how to implement a custom search provider.
Getting started
Telligent Evolution searches try to be as generic as possible to make it easier to support multiple search providers, but there may be instances where the syntax is specific to Solr's implementation. In these cases, the custom search provider will either need to support the same syntax or convert the syntax to its own syntax. See the supported search syntax documentation for more information.
Creating the search provider
Telligent Evolution uses a simple interface to communicate with search providers. ISearchProvider defines the methods used by the search service to index new documents, remove documents from the index, and perform searches on behalf of the user.
namespace Telligent.Evolution.Extensibility.Content.Version1
{
public interface ISearchProvider : ISingletonPlugin
{
// Indexing
void IndexContent(IEnumerable<SearchIndexDocument> contentToIndex);
void RemoveFromIndexByQuery(SearchIndexDeleteOptions query);
void RemoveFromIndexById(string id);
// Searching
SearchResults Search(SearchResultsListOptions query);
SearchResults MoreLikeThis(string id, string filters, int pageSize, int pageIndex, string sort);
}
}
| Method |
Parameter |
Notes |
| void IndexContent() |
|
This method is used to add content to the search index. |
|
IEnumerable <SearchIndexDocument> |
An enumeration of the search documents to index. |
| void RemoveFromIndexByQuery() |
|
This method removes content from the index based on the results of a simplified search query. |
|
SearchIndexDeleteOptions |
The results that match these options should be removed from the index. |
| void RemoveFromIndexById() |
|
Removes a single piece of content from the search index. |
|
string |
A string representing the unique Id of the content to remove. |
| SearchResults Search() |
|
The primary search method used for all searches other than More Like This searches. It returns a set of search results as well as facet counts. |
|
SearchResultsListOptions |
The set of options to use when making the search, these include search terms, filters, facets, etc. |
| SearchResults MoreLikeThis() |
|
This method returns results that are similar to the content matching the 'id' parameter and filters out results that do not match the 'filters' parameter. Mostly commonly the contents of the specified index document are compared to the contents of other indexed documents and best matches are returned. |
|
string id |
The unique Id of the document to use to find other, similar documents. |
|
string filters |
Filters to apply to the matching documents, used to narrow the results. |
|
int pageSize |
The number of results to return. |
|
int pageIndex |
The page of the results to return. |
|
string sort |
Order the results should be returned in, valid values for SearchResultsListOptions.Sort are also valid here. |
The ISearchProvider interface is an implementation of the ISingletonPlugin. This means that in addition to being a plugin, only one ISearchProvider plugin can be enabled at a time. This is done to avoid confusion while determining which search provider to use if there is more than one on the site.
Once a custom search provider has been created, place the DLL into both the Web\bin and the JobScheduler folders. Then in the Manage Plugins page in the Control Panel, disable the "Solr Search Provider" and enable the custom search provider to use the new functionality.
Content will not automatically be reindexed when switching search providers so it is best to force a reindex. This can be done by running the Reset_SearchIndexes.sql script in the SqlScripts folder in the install package.
All search requests and index updates will now use the custom search provider instead of the Solr provider.