Ontolica for SharePoint Public API

SearchDialogComponent Class

Serves as the base class for custom search dialog components.

For a list of all members of this type, see SearchDialogComponent Members.

System.Object
   Control
      WebControl
         SearchDialogComponent

[Visual Basic]
MustInherit Public Class SearchDialogComponent
Inherits WebControl
[C#]
public abstract class SearchDialogComponent : WebControl

Remarks

The Ontolica Search web part comes with a variety of different search dialogs to meet the different needs of our customers. These search dialogs are based on a very flexible framework that allows you to just customize the existing dialogs or write a new one from scratch. You can use the SearchDialogComponent class for both situations.

Writing a custom search dialog component involves the following steps:

  1. Create a new Visual Studio solution or open an existing one.
  2. Add a new .NET class library project.
  3. Add a reference to the assembly NavigoSystems.Ontolica.SharePoint.dll, which can be found in the Global Assembly Cache or in the Bin directory where ONTOLICA for SharePoint was installed.
  4. Add a new class that inherits from the SearchDialogComponent class.
  5. Override the Query property.
  6. Override the RenderComponent(HtmlTextWriter) method to generate HTML output or RenderComponent(XmlWriter) to generate XML output that will be transformed to HTML with an XSLT template.
  7. Build the project.
  8. Copy the output .NET assembly (DLL file) to the Global Assembly Cache (C:\Windows\assembly) on every front-end web server in the SharePoint server farm.
  9. Register the custom component in the Ontolica Search configuration file OntolicaSearch.xml on every front-end web server in the SharePoint server farm. Register the component as shown in the following example:
    <SearchDialogs>
      <SearchDialog name="Default" template="Default">
        ...
        <Component type="Custom">
          <Assembly>NavigoSystems.Ontolica.SharePoint.Samples, Version=1.0.0.0, Culture=neutral, 
    PublicKeyToken=55c050f4be48e374</Assembly>
          <TypeName>NavigoSystems.Ontolica.SharePoint.Samples.HelloWorldComponent</TypeName>
        </Component>      
        ...
      <SearchDialog>
    </SearchDialogs>
    
    where the template attribute specifies the XSLT template to use for transforming XML output to HTML. Ontolica will look for the XSLT file in the Templates\<LCID> directory relative to the Ontolica root directory. This yields the following filename for a default English installation: C:\Program Files\Navigo Systems\ONTOLICA for SharePoint\Templates\1033\Default.searchdialog.xsl
  10. Adapt the XSLT template if the component outputs XML instead of HTML.

See the Ontolica Administrators Guide for more information on developing custom search dialogs.

Example

The following example illustrates the simplest possible implementation of a custom search dialog component.

[C#]
  
namespace MyCompany.Ontolica.SharePoint
{
  using NavigoSystems.Ontolica.SharePoint.Custom;
  using NavigoSystems.Ontolica.SharePoint.Custom.WebControls;

  public class HelloWorldComponent : SearchDialogComponent
  {
    public HelloWorldComponent() {}

    protected override OntolicaQuery Query
    {
      get 
      { 
        OntolicaQuery query = CreateQuery();
        query.Expression = "Hello World";
        return query; 
      }

      set 
      { 
      }
    }

    protected override void RenderComponent(System.Web.UI.HtmlTextWriter output)
    {
      output.Write("Hello World");
    }
  }
}

Requirements

Namespace: NavigoSystems.Ontolica.SharePoint.Custom.WebControls

Assembly: NavigoSystems.Ontolica.SharePoint (in NavigoSystems.Ontolica.SharePoint.dll)

See Also

SearchDialogComponent Members | NavigoSystems.Ontolica.SharePoint.Custom.WebControls Namespace