Developing your first plugin - Final steps

This tutorial covers enabling a plugin on a search and testing it on real data.

Prerequisites

Before using this guide ensure that you have installed the plugin.

Choose a suitable search to test it with

On your Funnelback server create a new web data source or use an existing web data source that is suitable for testing with the plugin. In this guide, we’re going to assume you have a standard web data source that points to www.example.com. So there will be one document in this data source by default.

Before enabling plugin on example.com

Enable and configure the plugin following the instructions that are outlined in the plugin’s readme file.

The configuration that requires editing will depend on what the plugin runs on (this was configured when the plugin was created) and may need to be configured in multiple places. If the plugin runs on a data source then it needs to be set in the data source configuration of each data source that it should be applied to. If the plugin runs on a results page then it needs to be set in the results page configuration of each applicable results page.

Edit the data source configuration from the administration dashboard and add the following keys:

plugin.title-prefix-plugin.enabled=true
plugin.title-prefix-plugin.version=1.0.0
plugin.title-prefix-plugin.config.pattern=Example
plugin.title-prefix-plugin.config.replaceWith=My First Plugin! -
configuration key view of plugin

Rerun the search and observe the output comparing the titles to what was returned before the plugin was enabled.

Before enabling plugin on example.com
Some plugins will require a reindex to take effect. The example plugin here works without a reindex because it only implements the search lifecycle interface which only makes query-time modifications.

Congratulations

You have now created your first plugin.

Did something go wrong?

If you followed this guide exactly you should have a working plugin at this point. However there are many places where things can go wrong. Things not working the first time round is a vital part of the developer experience, and its also important to learn how to debug what went wrong. The final note in our guide is to look at some hints for using logging to help understand what is happening.

The source files used for the title prefix plugin developed in this guide are available for your reference.

Next steps

Take a look at the plugin developer documentation and check out the different interfaces that are available.

Some suggestions:

  • Write a filter plugin that modifies the page titles before they are indexed (providing a similar end result to what was implemented in this tutorial).

  • Write a custom gatherer plugin that downloads all of the links contained in an RSS feed.

  • Write a plugin that gathers content from a different social media service like Vimeo - implementing the custom gatherer interface to communicate with the API and fetch the content, the indexer interface to set default metadata mappings and faceted navigation interface to create some default facets for the search.

© 2015- Squiz Pty Ltd