With the recently released Multiple Database Search plug-in you will see an example of how to implement the “com.ibm.rcp.search.engines.searchEngines” extension point. This extension puts a new search entry in the search toolbar dropdown:
You can look at the plugin.xml in the project to see the extension definition. Let’s walk through how this extension is configured:
//The first extension declares the engine <extension point="com.ibm.rcp.search.engines.searchEngines"> <searchEngine data="1073873011" // Initialization data given to the class, we dont use this really engine="org.openntf.mailsearch.SearchEngine" // The class name for our engine global="true" // We want our engine to always be available hasResults="true" // We will use the regular search UI page icon="icon/dbicon1.gif" // Our icon in the drop down menu id="org.openntf.mailsearch.SearchEngine" // the id of our engine label="Multiple DB Search" // The label for our engine (shows in the drop down) type="other"/> // We are not a regular type so just put other </extension> //The next extension actually adds the engine to the UI, it is pretty self explanatory <extension point="com.ibm.rcp.search.ui.searchBarSets"> <searchBarSet id="org.openntf.mailsearch.SearchEngine" label="Multiple DB Search" visible="true"> <searchBarItem engineID="org.openntf.mailsearch.SearchEngine" id="org.openntf.mailsearch.SearchEngine.item" /> </searchBarSet> </extension>
The engine parameter is really the key parameter as it points the search framework to our class that does the heavy lifting. The class is what is responsible for actually executing the search across the selected databases. Following this sample you can now create a search to essentially anything that Java code has access to.
Our search engine uses multiple threads to search across the databases. Since the back-end Java API’s can be accessed from multiple threads this makes it a pretty big advantage performance wise. If your databases are also full text indexed, you will see some pretty impressive performance with this technique. I will save the threading discussion for another post…