You can create a COM ContextCog in any language that supports the creation of COM objects that can implement interfaces. You should be familiar with COM and type libraries to create a COM ContextCog.
Before you begin, you must import the ContextCog type library into your development environment. The type library is contained within the isysbox.dll installed in the Perceptive Enterprise Search folder.
To create a COM ContextCog, you must create an object that implements IISYSBoxProvider as exported from the ContextCog type library.
The IISYSBoxProvider contains the following methods:
Procedure IISYSBoxProvider.GenerateSchema(Schema: IISYSBoxSchema)
Allows you to create configuration options that users of your ContextCog will need to provide at configuration time. The Schema object contains methods that you can call to add your schema elements.
Procedure IISYSBoxProvider.Prepare(Properties: IISYSBoxProperties)
Called before the Process method, Prepare allows you to initialize your ContextCog with the properties collected at configuration time.
Procedure IISYSBoxProvider.Process(ResultList: IISYSResultList; Properties: IISYSBoxProperties; Query: String; out Result: WideString; out Score: Integer);
The Process method is called to get the result from your ContextCog. Your cog is passed the ISYSResultList object that contains the search results, the configuration properties, and the query the user entered.
You need to set the Result to either XML if using an XSLT, or HTML if not. You must also provide a Score for the result. The ContextCog with the highest score will be shown above the search results.
You do not implement the IISYSBoxSchema interface yourself; it is passed to the GenerateSchema method of your object. The schema object allows you to create properties that the administrator will be prompted to provide when importing your ContextCog.
Procedure IISYSBoxSchema.Add(Name: String Caption: String; DataType: Integer; Default: String; Other: Variant);
You call add for every property that you wish to publish, specifying the:
· Name – the name of the property. This should contain letters and numbers only. It must start with a letter.
· Caption – a display prompt shown to the user when configuring your ContextCog.
· DataType – the variant data type of the property; for example VT_BSTR of VT_UI4.
· Default – the default value to use if a property is not provided in the configuration.
· Other – contains a list of elements to be shown in a drop-down box.
You do not implement the IISYSBoxProperties interface yourself; it is passed to the Prepare and Process methods of your object.
Property IISYSBoxProperites.Count as Integer
Returns the number of configured properties.
Property IISYSBoxProperites.Keys(Index: Integer) as String
Returns the name of the property at the given index.
Property IISYSBoxProperites.Values(NameOrIndex: Variant) as String
Returns the property with the given name, or at the given index.
See c:\Program Files\Perceptive Enterprise Search\WebCog\Samples