Skip to main content
Jump to: navigation, search


< SMILA‎ | Documentation
Revision as of 05:36, 30 January 2009 by (Talk | contribs) (Configuration files)

Bundle: org.eclipse.smila.lucene.LuceneIndexService


This ProcessingService is used to index SMILA records in a Lucene document index. It supports adding, updating and deleting of records.



The LuceneIndexService uses the Annotation org.eclipse.smila.lucene.LuceneIndexService on records to decide how to handle a record. It supports the following required values.

Name Value Description
indexName a String the name of the index to work on
executionMode ADD or DELETE ADD - add or update the record, DELETE - delete the record from the index

Configuration files

  • configuration/

Here the Lucene index structure and the search template are configured. It is possible to define more than one index here. The index to work on is set by the Annotation "indexName". The defined "FieldNo" are referenced in LuceneAttributeMapping.xml and LuceneAttachmentMapping.xml. For more information about configuration of DataDictionary.xml see Anyfinder documentation. This file is used to prepared the settings for indicies. When an index is needed, it is created automatically on demand, and configuration is loaded from this file to created the index. (Beside: the Framework creates a Datadictionary.xml file also in the workspace. This file only contains the information(settings/configuration) for created indices). The Framework will create an index by itself, when a record is configured to be stored in an index. But the user can also use the createIndex JMX-command to create an index.

  • configuration/org.eclipse.smila.lucene/Mappings.xml

Here a mapping of attribute and attachment names to Lucene "FieldNo" (defined in DataDictionary.xml) is configured. It is possible to define mappings for multiple indexes in this file, using the same "indexName" as in file DataDictionary.xml.


The following example was used in the SMILA example application to index records delivered by Filesystem- and WebCrawler.


<extensionActivity name="invokeLuceneService">
        <proc:service name="LuceneIndexService" />
        <proc:variables input="request" output="request" />
            <rec:An n="org.eclipse.smila.lucene.LuceneIndexService">
                <rec:V n="indexName">test_index</rec:V>
                <rec:V n="executionMode">ADD</rec:V>


<?xml version="1.0" encoding="UTF-8"?>
<AnyFinderDataDictionary xmlns="" xmlns:xsi=""
  xsi:schemaLocation=" ../xml/AnyFinderDataDictionary.xsd">
  <Index Name="test_index">
    <Connection xmlns="" MaxConnections="5"/>
    <IndexStructure xmlns="" Name="test_index">
      <Analyzer ClassName="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
      <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="Date" 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"/>
      <Field FieldNo="0" Name="ID"/>
    <Configuration xmlns="" xmlns:xsi=""
      xsi:schemaLocation=" ../xml/DataDictionaryConfiguration.xsd">
        <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"/>
      <Result Name="">
        <ResultField FieldNo="5" Name="Title"/>
        <ResultField FieldNo="4" Name="Url"/>
        <ResultField FieldNo="3" Name="Date"/>
        <ResultField FieldNo="2" Name="Path"/>
        <ResultField FieldNo="1" Name="Filename"/>
      <HighlightingResult Name="">
        <HighlightingResultField FieldNo="0" Name="Content" xsi:type="HLTextField">
          <HighlightingTransformer Name="urn:Sentence">
            <ParameterSet xmlns="">
              <Parameter Name="MaxLength" xsi:type="Integer">
              <Parameter Name="MaxHLElements" xsi:type="Integer">
              <Parameter Name="MaxSucceedingCharacters" xsi:type="Integer">
              <Parameter Name="SucceedingCharacters" xsi:type="String">
              <Parameter Name="SortAlgorithm" xsi:type="String">
              <Parameter Name="TextHandling" xsi:type="String">
          <HighlightingParameter xmlns=""/>
  <Index Name="another_index">


<?xml version="1.0" encoding="utf-8" ?>
<Mappings xmlns="">
    <Mapping indexName="test_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" />
            <Attachment name="Text" fieldNo="0" />
    <Mapping indexName="another_index">

Back to the top