Send an object

Send an object

The most important class for the CMIS crawler is mindbreeze.example.cmis.crawler.CmisCrawler This implements the plug-in interface for crawler com.mindbreeze.enterprisesearch.mesapi.crawler.Crawler:


public interface Crawler {
	public void init (Configuration configuration);
	
	public void performCrawlRun(FilterAndIndexClient client) throws Exception;
	
	public void shutdown();
}


The init method serves as the preparation of the crawler for the crawler runs. Here databases, for example, can be built up. The counterpart is the shutdown method – this is invoked before the ending of the crawler.

performCrawlRun is invoked for every crawl run. The objects are indexed by the data source. The call


client.filterAndIndex(indexable);


sends an object

The Indexable object collects the relevant data for a transmitted object. The following minimal example prepares an object for the indexing:


Indexable indexable = new Indexable();
indexable.setKey("1");
indexable.setTitle("my title");


The key sets the key for the object in the data source. The title sets the title of the object.

You can now already search in the Mindbreeze web client for the indexed document.

Important: When defining the key you should be aware that the crawler can be configured for multiple data sources of the type. This example can index objects from CMIS data sources. Multiple crawlers can be configured, for example for Fabasoft Folio Cloud Austria and Fabasoft Folio Cloud Germany. So that an object can be uniquely identified across multiple data sources, the key in the index consists of 3 parts. The type of the data source (category), the data source (category instance) and the key. The category is set for the plug-in. The category instance can be configured in the configuration user interface:


For the example you can use the standard settings. However, you have to be aware that when creating a further data source a different category instance can be configured, since otherwise objects from e.g. Fabasoft Folio Cloud Austria will overwrite objects from Fabasoft Folio Cloud Germany.

Displayed date and change date

In order to set the displayed date for the indexed object use setDate.


indexable.setDate(cmisDocument.getCreationDate());


This is also the date that is used if you sort according to date.

In addition to the displayed date there is also the change date of the document. This date is used to determine whether a document has been changed or not.


indexable.setModificationDate(cmisDocument.getLastModificationDate());


All data values must be converted into UTC before being sent. Only this ensures that the values are correctly displayed and that there are no problems with time zones or summer/winter times.