The Telligent Evolution platform uses CommunityServer.Components.ISearchProvider when issuing search requests. CommunityServer.Components.ISearchProvider performs the following:

  • Handles (if possible and/or applicable) all properties defined on the SearchQuery class.
  • Should apply permissions/role checks when issuing queries.  Services.Get<IRoleService>()GetAllRolesForUser(user) can be used to get a list of roles for a user.

When indexing native content (blogs, forum, etc), consider using the field names already being used within Telligent Evolution Platform.  If you let the existing document mapping process behave as-is, then you will get this behavoir described in the CommunityServer.Components.Search.SearchFields class.   If you plan to use the existing module (CSSearchModule) to keep content in sync, reusing existing fieldnames is very important because it has dependancies (for deletes) on data being indexed using the following field names:

  • SearchFields.ContentID
  • SearchFields.ThreadID
  • SearchFields.ContentType
  • SearchFields.UserID
  • SearchFields.GroupID

Method

The SearchResults Search(SearchQuery)is responsible for processing the criteria from SearchQuery and issuing a request to the search service. You should set BestMatch and BestMatchTitle on each SearchDocument in the SearchResults and highlight any query terms in these properties if highlighting is supported.

    Properties 

    Property Description

    bool SupportsRangeQueries

    Denotes whether or not the provider supports queries in which the criteria contains a range. For example, searching by a date range. Custom range queries can be implemented using the RangeFilters collection on the SearchQuery class.

    bool SupportsCollapsedResults

    Denotes whether or not the provider supports collapsed results.  Collapsed results are when the provider can return one result for a set results.  For example, returning one (most relevant) result for forum thread. 

    ISearchHighlightingConfiguration HighlightingConfiguration

    Customizable highlighting configuration. In most situation you can use the existing implementation of  CommunityServer.Components.Search.SearchConfiguration.

    Implement a class

    To create a class to implement the search provider interface:

    1. Open a new class library project and create a new class that implements the ISearchProvider interface.

    2. Implement the methods and properties for your provider and build the assembly.

    3. Bind your search provider by:

      1. Opening the \modules\SearchModule.config file for editing.

      2. Updating the binding for CommunityServer.Components.ISearchProvider.

      3. Specifying your new class and assembly in the "to" attribute value as shown in the following example:

    <bind service="CommunityServer.Components.ISearchProvider, CommunityServer.Components"
    to="MyCustomSearch.Search.MyCustomSearchProvider, MyCustomSearch.Search"
    scope="singleton"/>

    In the example above, MyCustomSearch.Search.MyCustomSearchProvider is the name of the class that implements CommunityServer.Components.ISearchProvider and MyCustomSearch.Search is the name of the assembly (without the .dll extension) that contains this class.