Skip to main content
Jump to: navigation, search

SMILA/5 Minutes Tutorial

Revision as of 09:31, 28 November 2011 by (Talk | contribs) (Configuration overview: SMILA -> smila)

This page contains installation instructions for the SMILA application which will help you taking the first steps with SMILA.

Download and unpack SMILA

Download the SMILA package and unpack it to an arbitrary folder. This will result in the following folder structure:


Check the preconditions

To be able to follow the steps below, check the following preconditions:

  • You will have to provide a JRE executable to be able to run SMILA. The JVM version should be at least Java 5.
    • add the path of your local JRE executable to the PATH environment variable
    • add the argument -vm <path/to/jre/executable> right at the top of the file SMILA.ini.
      Make sure that -vm is indeed the first argument in the file and that there is a line break after it. It should look similar to the following:


  • Since we are going to use JConsole as the JMX client later in this tutorial, it is recommended to install and use a Java SE Development Kit (JDK) and not just a Java SE Runtime Environment (JRE) because the latter does not include this application.
  • You need a REST HTTP client to access the SMILA REST API (e.g. "RESTClient" or "Poster" add-on for Firefox browser)
  • When using the Linux distributable of SMILA, make sure that the files SMILA and jmxclient/ have executable permissions. If not, set the permission by running the following commands in a console:

chmod +x ./SMILA
chmod +x ./jmxclient/

  • When using MAC switch to and set the permission by running the following commands in a console:

chmod a+x ./SMILA


To start the SMILA engine, simply double-click the SMILA executable. Alternatively, open a command line, navigate to the directory where you extracted the files to, and call the SMILA executable. Wait until the engine has been fully started. If everything works fine, you should see output similar to that on the following screenshot:


When using MAC switch in terminal to and then start with ./SMILA

Check the log file

Open the SMILA log file in an editor of your choice to find out what is happening in the background. This file is named SMILA.log and can be found in the same directory as the SMILA executable:

  -> SMILA.log <-

You should see no stacktraces in the log ;) and it should end with an entry like that:

INFO  ... internal.HttpServiceImpl    - HTTP server started successfully on port 8080.

Start indexing job run

We are going to start the predefined indexing job "indexUpdateJob" based on the predefined asynchronous "indexUpdate" workflow. This indexing job will process the imported data.

The "indexUpdate" workflow contains a PipelineProcessorWorker worker which executes the synchronous "AddPipeline" BPEL workflow. So, the synchronous "AddPipeline" BPEL workflow is embedded in the asynchronous "indexUpdate" workflow. For more details about the "indexUpdate" and "indexUpdateJob" definitions see SMILA/configuration/org.eclipse.smila.jobmanager/workflows.json and jobs.json). For more information about job management in general please check the JobManager documentation.

Use your favourite REST Client to start a job run for the job "indexUpdateJob":

POST http://localhost:8080/smila/jobmanager/jobs/indexUpdateJob

Your REST client will show a result like that:

  "jobId" : "20110901-121343613053",
  "url" : "http://localhost:8080/smila/jobmanager/jobs/indexUpdateJob/20110901-121343613053/"

You will need the "jobId" later on to finish the job run. The job run Id can also be found via the monitoring API for the job:


In the SMILA.log file you will see a message like that:

INFO ... internal.JobManagerImpl    - started job run '20110901-121343613053' for job 'indexUpdateJob'

Configure the File System crawler

Prepare some local folder on your system whose contents we are going to index in the following. Add some text and HTML files to it. The result could look similar to the following:


Note: Currently, only plain text and HTML files can be crawled and indexed properly.

Open the configuration file at configuration/org.eclipse.smila.connectivity.framework/file.xml and adapt the BaseDir attribute to point to this folder. Make sure to set an absolute path:


For details on the configuration please refer to the documentation of the Filesystem Crawler.

Start the File System crawler

Next step is to start a file system crawler job and let SMILA index the configured folder. There are three alternatives how to interact with crawlers:

  • JMX via JConsole
  • SMILA JMX Client

All three ways will be described in the following sections.


You can monitor the state of the configured crawlers via SMILA REST API:


Use your favourite REST Client to start an import run for data source "file" and the job "indexUpdateJob":

 POST http://localhost:8080/smila/crawlers/file

A successful call will return the import run id:

  "importRunId" : 1285938333

The state of the current import run can be monitored via:


More information about the Crawler(Controller) REST API can be found in the CrawlerController documentation

Using JConsole

Crawler runs can be managed via the JMX protocol, therefore you can connect to SMILA using any JMX client you like. We are going to use JConsole in the following because it is included in the Java SE Development Kit.

Start the JConsole executable in your JDK distribution (<JAVA_HOME>/bin/jconsole). If the client is up and running, connect to localhost:9004.


Next, switch to the MBeans tab, expand the SMILA node in the MBeans tree on the left-hand side, and click the CrawlerController node. This node is used to manage and monitor all crawling activities.


To start the File System crawler, select SMILA > CrawlerControl > Operations on the left-hand side, enter "file" into the first text field next to the startCrawlerTask button, and "indexUpdateJob" in the second text field. Then click the button:


You should receive a message similar to the following, indicating that the crawler has been successfully started:


The following entries will appear in the SMILA.log file:

INFO  [Thread-21  ]  filesystem.FileSystemCrawler        - Initializing FileSystemCrawler...
INFO  [Thread-21  ]  filesystem.FileSystemCrawler        - Closing FileSystemCrawler...

Using JMX Client

Instead of managing the crawler runs using JConsole it is also possible to use the JMX Client from the SMILA distribution for the same purpose. The JMX Client is a console application that allows managing crawler runs and creating scripts intended for batch crawler execution. It can be found in the jmxclient directory of the SMILA distribution. Use the appropriate run script for your platform (i.e. run.bat or to start the application. For example, to start the File System crawler - as described with JConsole above - use the following command:

 run crawl file indexUpdateJob

For more information please check the JMX Client documentation.

Error handling

The following errors can occur when starting the crawler via SMILA REST API resp. JConsole:

  • If you specified a non-existing data source, you will see an appropriate error message.
  • If you specified a non-existing or non-started job name, you will see an appropriate error message.
  • If the File System crawler cannot find the folder to index, the log file also shows an error:
INFO  [Thread-24  ]  filesystem.FileSystemCrawler        - Initializing FileSystemCrawler...
WARN  [Thread-24  ]  performancecounters.CrawlerControllerPerformanceCounterHelper - Agent location [Crawlers/FileSystem/file - 1491048155] is not found
WARN  [Thread-24  ]  performancecounters.CrawlerControllerPerformanceCounterHelper - Instance agent agent is null
ERROR [Thread-24  ]  impl.CrawlThread                    - 
org.eclipse.smila.connectivity.framework.CrawlerCriticalException: Folder "/home/doe01/doesnotexist" is not found
  at org.eclipse.smila.connectivity.framework.crawler.filesystem.FileSystemCrawler.checkFolders(
  at org.eclipse.smila.connectivity.framework.crawler.filesystem.FileSystemCrawler.initialize(
INFO  [Thread-24  ]  filesystem.FileSystemCrawler        - Closing FileSystemCrawler...

The error message above states that the crawler tried to index a folder at /home/doe01/doesnotexist but was not able to find it. To solve this, provide data at the mentioned folder or adapt the configuration of the File System crawler accordingly.

Search the index

To search the index which was created by the crawlers, point your browser to http://localhost:8080/SMILA/search. There are currently two stylesheets from which you can select by clicking the respective links in the upper left corner of the header bar: The Default stylesheet shows a reduced search form with text fields like Query, Result Size, and Index Name, adequate to query the full-text content of the indexed documents. The Advanced stylesheet in turn provides a more detailed search form with text fields for meta-data search like for example Path, MimeType, Filename, and other document attributes.


Now, let's try the Default stylesheet and enter our first simple search using a word that you expect to be contained in your dummy files. In this tutorial, we assume that there is a match for the term "data" in the indexed documents. First, select the index on which you want to search from the Indexlist column on the left-hand side. Currently, there should be only one in the list, namely an index called "test_index". Note that the selected index name will appear in the Index Name text field of the search form. Then enter the desired term into the Query text field. And finally, click OK to send your query to SMILA. Your result could be similar to the following:


Now, let's use the Advanced stylesheet and search for the name of one the files contained in the indexed folder to check whether it was properly indexed. In our example, we are going to search for a file named smila-glossary.html. Click Advanced to switch to the detailed search form, enter the desired file name into the Filename text field, then click OK to submit your search. Your result could be similar to the following:


Configure and run the Web crawler

Now that we already know how to start and configure the File System crawler and how to search indices, configuring and running the Web crawler is rather straightforward.

Note: There's no need to define a new job or start a new job run here, because we want to use the same asynchronous workflow for indexing as before and so we can use the still running job run here.

Configure the Web crawler

Let's have a look at the configuration file of the Web crawler which you can find at configuration/org.eclipse.smila.connectivity.framework/web.xml:

<DataSourceConnectionConfig  ...>
  <RecordBuffer Size="20" FlushInterval="3000" />
    <WebSite ProjectName="Example Crawler Configuration" Header="Accept-Encoding: gzip,deflate; Via: myProxy" Referer="http://myReferer">
      <UserAgent Name="Crawler" Version="1.0" Description="teddy crawler" Url="" Email=""/>
      <CrawlingModel Type="MaxDepth" Value="1000"/>
      <CrawlScope Type="Path" />
      <Seeds FollowLinks="NoFollow">
        <Filter Type="RegExp" Value=".*action=edit.*" WorkType="Unselect"/>
        <Filter Type="RegExp" Value="^((?!/SMILA).)*$" WorkType="Unselect"/>
        <MetaTagFilter Type="Name" Name="robots" Content="noindex,nofollow" WorkType="Unselect"/>

By default, the Web crawler is configured to index the URL To change this, set the content of the <Seed> element to the desired web address and adapt the <Filters> section accordingly. If you require further help on this configuration file refer to the Web crawler documentation. For example, in the following we changed the web address to the main page of Wikipedia and removed one of the <Filter> elements:

 <Seeds FollowLinks="NoFollow">
   <Filter Type="RegExp" Value=".*action=edit.*" WorkType="Unselect"/>

Start the Web crawler

To start the crawling process, we again have the alternatives as described for the File System Crawler start above.

Using SMILA REST API to start/stop the Web Crawler

To start the web crawler via REST API:

 POST http://localhost:8080/smila/crawlers/web

Although the default limit for spidered web sites is set to 1,000 in the Web crawler configuration file, it may take a while for the web crawling run to be finished. The state of the current import run can be monitored via:


If you do not want to wait, you may as well stop the crawling run:

 POST http://localhost:8080/smila/crawlers/web/finish
Using JConsole to start/stop the Web Crawler

For using JConsole to start the web crawler, navigate to SMILA > CrawlerController > Operations, type "web" and "indexUpdateJob" into the text fields next to the startCrawlerTask button, then click the button.


A message like that will pop up after successfull start:


Click the getCrawlerTasksState button to monitor the crawl processing if you want to find out when it has finished. This will produce an output similar to the following:


To stop the import run, type "web" into the text field next to the stopCrawlerTask button, then click this button.

Search the index

As soon as the Web crawler's run has finished, go back to the search form to search the generated index:


Stop indexing job run

Although there's no need for it, we can finish our previously started indexing job run via REST client now: (please replace <job-id> by the job-id you got before when started the job run)

POST http://localhost:8080/smila/jobmanager/jobs/indexUpdateJob/<job-id>/finish  

You can monitor the job run via browser to see that it finished successful:


In the SMILA.log file you will see messages like that:

 INFO ... internal.JobManagerImpl   - finish called for job 'indexUpdateJob', run '20110901-141457584011'
 INFO ... internal.JobManagerImpl   - Completing job run '20110901-141457584011' for job 'indexUpdateJob' with final state SUCCEEDED

Just another 5 minutes to change the workflow

In previous sections all data collected by crawlers was processed with the same asynchronous "indexUpdate" workflow using the BPEL pipeline "AddPipeline". All data was indexed into the same index named "test_index". It is possible, however, to configure SMILA so that data from different data sources will go through different workflows and pipelines and will be indexed into different indices. This will require more advanced configuration features than before but still quite simple ones.

In the following sections we are going to use the generic asynchronous "importToPipeline" workflow which let you specify the BPEL pipeline to process the data. We create an additional BPEL pipeline for webcrawler records so that webcrawler data will be indexed into a separate index named "web_index".

Configure LuceneIndexService

It's very important to shutdown and restart the SMILA engine after the following configuration changes are done because modified configurations are loaded during startup only.

For more information about the LuceneIndexService, please see LuceneIndexService.

Let's configure our "web_index" index structure and search template. Add the following code to the end of configuration/ file before the closing </AnyFinderDataDictionary> tag:

  <Index Name="web_index">
    <Connection xmlns="" MaxConnections="5"/>
    <IndexStructure xmlns="" Name="web_index">
      <Analyzer ClassName="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
      <IndexField FieldNo="8" IndexValue="true" Name="MimeType" StoreText="true" Tokenize="true" Type="Text"/>
      <IndexField FieldNo="7" IndexValue="true" Name="Size" StoreText="true" Tokenize="true" Type="Text"/>
      <IndexField FieldNo="6" IndexValue="true" Name="Extension" StoreText="true" Tokenize="true" Type="Text"/>
      <IndexField FieldNo="5" IndexValue="true" Name="Title" StoreText="true" Tokenize="true" Type="Text"/>
      <IndexField FieldNo="4" IndexValue="true" Name="Url" StoreText="true" Tokenize="false" Type="Text">
        <Analyzer ClassName="org.apache.lucene.analysis.WhitespaceAnalyzer"/>
      <IndexField FieldNo="3" IndexValue="true" Name="LastModifiedDate" StoreText="true" Tokenize="false" Type="Text"/>
      <IndexField FieldNo="2" IndexValue="true" Name="Path" StoreText="true" Tokenize="true" Type="Text"/>
      <IndexField FieldNo="1" IndexValue="true" Name="Filename" StoreText="true" Tokenize="true" Type="Text"/>
      <IndexField FieldNo="0" IndexValue="true" Name="Content" StoreText="true" Tokenize="true" Type="Text"/>
    <Configuration xmlns="" xmlns:xsi="" 
  xsi:schemaLocation=" ../xml/DataDictionaryConfiguration.xsd">
        <Field FieldNo="8">
          <FieldConfig Constraint="optional" Weight="1" xsi:type="FTText">
            <Parameter xmlns="" Operator="OR" Tolerance="exact"/>
        <Field FieldNo="7">
          <FieldConfig Constraint="optional" Weight="1" xsi:type="FTText">
            <Parameter xmlns="" Operator="OR" Tolerance="exact"/>
        <Field FieldNo="6">
          <FieldConfig Constraint="optional" Weight="1" xsi:type="FTText">
            <Parameter xmlns="" Operator="OR" Tolerance="exact"/>
        <Field FieldNo="5">
          <FieldConfig Constraint="optional" Weight="1" xsi:type="FTText">
            <Parameter xmlns="" Operator="OR" Tolerance="exact"/>
        <Field FieldNo="4">
          <FieldConfig Constraint="optional" Weight="1" xsi:type="FTText">
            <Parameter xmlns="" Operator="OR" Tolerance="exact"/>
        <Field FieldNo="3">
          <FieldConfig Constraint="optional" Weight="1" xsi:type="FTText">
            <Parameter xmlns="" Operator="OR" Tolerance="exact"/>
        <Field FieldNo="2">
          <FieldConfig Constraint="optional" Weight="1" xsi:type="FTText">
            <Parameter xmlns="" Operator="OR" Tolerance="exact"/>
        <Field FieldNo="1">
          <FieldConfig Constraint="optional" Weight="1" xsi:type="FTText">
            <Parameter xmlns="" Operator="OR" Tolerance="exact"/>
        <Field FieldNo="0">
          <FieldConfig Constraint="required" Weight="1" xsi:type="FTText">
            <NodeTransformer xmlns="" Name="urn:ExtendedNodeTransformer">
              <ParameterSet xmlns=""/>
            <Parameter xmlns="" Operator="AND" Tolerance="exact"/>

Now we need to add mapping of attribute and attachment names to Lucene "FieldNo" defined in DataDictionary.xml. Open configuration/org.eclipse.smila.lucene/Mappings.xml file and add the following code to the end of file before closing </Mappings> tag:

  <Mapping indexName="web_index">
      <Attribute name="Filename" fieldNo="1" />
      <Attribute name="Path" fieldNo="2" />    
      <Attribute name="LastModifiedDate" fieldNo="3" />
      <Attribute name="Url" fieldNo="4" />
      <Attribute name="Title" fieldNo="5" />    
      <Attribute name="Extension" fieldNo="6" />
      <Attribute name="Size" fieldNo="7" />
      <Attribute name="MimeType" fieldNo="8" />           
      <Attachment name="Content" fieldNo="0" />      

Create a new BPEL pipeline

We need to add the AddWebPipeline pipeline to the BPEL WorkflowProcessor. For more information about BPEL WorkflowProcessor please check the BPEL WorkflowProcessor documentation. Predefined BPEL WorkflowProcessor configuration files are contained in the configuration/org.eclipse.smila.processing.bpel/pipelines directory. However, we can add new BPEL pipelines with the SMILA REST API.

Start SMILA if it's not yet running, and use your favourite REST client to add the "AddWebPipeline" BPEL pipeline: (the BPEL XML is a little bit unreadable cause we have to escape it for being valid JSON content; after posting the new pipeline you can get a readable version via monitoring REST API - see below)

POST http://localhost:8080/smila/pipeline
    "definition":"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<process name=\"AddWebPipeline\" targetNamespace=\"\"\r\n    xmlns=\"\" \r\n    xmlns:xsd=\"\"\r\n    xmlns:proc=\"\" \r\n    xmlns:rec=\"\">\r\n  <import location=\"processor.wsdl\" namespace=\"\"\r\n      importType=\"\" />\r\n  <partnerLinks>\r\n    <partnerLink name=\"Pipeline\" partnerLinkType=\"proc:ProcessorPartnerLinkType\" myRole=\"service\" />\r\n  </partnerLinks>\r\n  <extensions>\r\n    <extension namespace=\"\" mustUnderstand=\"no\" />\r\n  </extensions>\r\n  <variables>\r\n    <variable name=\"request\" messageType=\"proc:ProcessorMessage\" />\r\n  </variables>\r\n  <sequence>\r\n    <receive name=\"start\" partnerLink=\"Pipeline\" portType=\"proc:ProcessorPortType\" operation=\"process\"\r\n        variable=\"request\" createInstance=\"yes\" />     \r\n    <if name=\"conditionIsText\">\r\n      <condition>starts-with($request.records/rec:Record[1]/rec:Val[@key=\"MimeType\"],\"text/\")</condition>\r\n      <sequence name=\"processTextBasedContent\">           \r\n        <if name=\"conditionIsHtml\">\r\n          <condition>starts-with($request.records/rec:Record[1]/rec:Val[@key=\"MimeType\"],\"text/html\")\r\n            or starts-with($request.records/rec:Record[1]/rec:Val[@key=\"MimeType\"],\"text/xml\")\r\n          </condition>\r\n        </if>        \r\n        <extensionActivity>\r\n          <proc:invokePipelet name=\"invokeHtml2Txt\">\r\n            <proc:pipelet class=\"org.eclipse.smila.processing.pipelets.HtmlToTextPipelet\" />\r\n            <proc:variables input=\"request\" output=\"request\" />\r\n            <proc:configuration>\r\n              <rec:Val key=\"inputType\">ATTACHMENT</rec:Val>\r\n              <rec:Val key=\"outputType\">ATTACHMENT</rec:Val>\r\n              <rec:Val key=\"inputName\">Content</rec:Val>\r\n              <rec:Val key=\"outputName\">Content</rec:Val>\r\n              <rec:Val key=\"meta:title\">Title</rec:Val>      \r\n            </proc:configuration>                      \r\n          </proc:invokePipelet>\r\n        </extensionActivity> \r\n        <extensionActivity>\r\n          <proc:invokePipelet name=\"invokeLucenePipelet\">\r\n            <proc:pipelet class=\"org.eclipse.smila.lucene.pipelets.LuceneIndexPipelet\" />\r\n            <proc:variables input=\"request\" output=\"request\" />\r\n            <proc:configuration>\r\n              <rec:Val key=\"indexname\">web_index</rec:Val>\r\n                <rec:Val key=\"executionMode\">ADD</rec:Val>\r\n              </proc:configuration>\r\n          </proc:invokePipelet>\r\n        </extensionActivity>\r\n      </sequence>        \r\n    </if>    \r\n    <reply name=\"end\" partnerLink=\"Pipeline\" portType=\"proc:ProcessorPortType\" operation=\"process\" variable=\"request\" />\r\n    <exit />\r\n  </sequence>\r\n</process>\r\n"

You can monitor the defined BPEL pipelines via browser, so you should find your new pipeline there:


Note that we used "web_index" index name for the LuceneService in the BPEL above:

  <rec:Val key="indexname">web_index</rec:Val>

Create and start a new indexing job

We define an indexing job based on the predefined asynchronous workflow "importToPipeline" (see SMILA/configuration/org.eclipse.smila.jobmanager/workflows.json). This indexing job will process the imported data by using our new BPEL pipeline "AddWebPipeline".

The "importToPipeline" workflow contains a PipelineProcessorWorker worker which is not configured for dedicated BPEL pipelines, so the BPEL pipelines handling adds and deletes have to be set via job parameter.

Use your favourite REST Client to create an appropriate job definition:

POST http://localhost:8080/smila/jobmanager/jobs/
      "tempStore": "temp",
      "addPipeline": "AddWebPipeline",
      "deletePipeline": "DeletePipeline" 

Note that the "DeletePipeline" is not needed for our test szenario here, but we must fulfill all undefined workflow parameters.

Afterwards, start a job run for the defined job:

POST http://localhost:8080/smila/jobmanager/jobs/indexWebJob

Put it all together

Ok, now it seems that we have finally finished configuring SMILA for using separate BPEL pipelines for file system and web crawling and index data from these crawlers into different indices. Here is what we have done so far:

  1. We added the web_index index to the Lucence configuration.
  2. We created a new BPEL pipeline for Web crawler data referencing the new Lucene index.
  3. We used a separate job for web indexing that references the new BPEL pipeline.

Now, run the Web crawler again, remember to use "indexWebJob" as job name parameter!

Go back to your browser at http://localhost:8080/SMILA/search, select the new index "web_index" and run a search:

Web index-search.png

Configuration overview

SMILA configuration files are located in the configuration directory of the SMILA application. The following lists the configuration files and documentation links relevant to this tutorial, regarding SMILA components:


  • configuration folder: org.eclipse.smila.connectivity.framework
    • file.xml (FileSystem Crawler)
    • web.xml (Web Crawler)
  • Documentation


BPEL Pipelines

Lucene Index Service

  • DataDictionary
    • configuration folder:
      • DataDictionary.xml
  • Lucene Mappings
    • configuration folder: org.eclipse.smila.lucene
      • Mappings.xml
  • Documentation

Back to the top