Jump to: navigation, search

SMILA/Documentation/Filesystem Crawler

< SMILA‎ | Documentation
Revision as of 08:53, 17 April 2009 by Igor.novakovic.empolis.com (Talk | contribs) (Crawling configuration)


The FileSystemCrawler recursively fetches all files from a given directory. Besides providing the content of files it may also gather any file's metadata from the following list:

  • full path
  • file name only
  • file size
  • last modified date
  • file content
  • file extension

Crawling configuration

The example configuration "file" can be found at configuration/org.eclipse.smila.framework.

Defining Schema: org.eclipse.smila.connectivits.framework.crawler.filesystem/schemas/FileSystemDataSourceConnectionConfigSchema.xsd.

Crawling configuration explanation

The root element of crawling configuration is CrawlJob and contains the following sub elements:

  • DataSourceID – the identification of a data source
  • SchemaID – specifies the schema for a crawler job
  • DataConnectionID – describes which agent crawler should be used
    • Crawler – implementation class of a Crawler
    • Agent – implementation class of an Agent
  • CompoundHandling – specify if packed data (like a zip containing files) should be unpack and files within should be crawled (YES or NO).
  • Attributes – list all attributes which describe a file. (LastModifiedDate, Filename, Path, Content, Extension, Size)
    • Attribute
      • Type (required) – the data type (String, Integer or Date).
      • Name (required) – attributes name.
      • HashAttribute – specify if a hash should be created (true or false).
      • KeyAttribute – creates a key for this object, for example for record id (true or false).
      • Attachment – specify if the attribute return the data as attachment of record.
  • Process – contains parameters for gathering data.
    • BaseDir – the directory the crawling process begin (if is null, cannot be found/access or is not a directory a CrawlerCriticalException will be thrown).
      • Filter – select file type and crawling mode.
        • Recursive – (true or false).
        • CaseSensitive – true or false
      • Include – file to crawl.
        • Name - String e.g. "*.txt" (crawl all text files). Everything that is not included is excluded automatically. You could use a star * as wildcard.
      • Exclude – files to leave out while crawling.
        • Name – String e.g. "*test*" (leave out all text files which have test in the filename).

Crawling configuration example

    <Attribute Type="Date" Name="LastModifiedDate" HashAttribute="true">
    <Attribute Type="String" Name="Filename">
    <Attribute Type="String" Name="Path" KeyAttribute="true">
    <Attribute Type="String" Name="Content" Attachment="true">
    <Attribute Type="String" Name="Extension"
    <Attribute Type="String" Name="Size">
    <Filter Recursive="true" CaseSensitive="false">
      <Include Name="*.txt"/>
      <Include Name="*.htm"/>
      <Include Name="*.html"/>
      <Include Name="*.xml"/>     

Output example for default configuration

For a text file named crawler.txt located in c:/data the crawler will create the following record:

<Record xmlns="http://www.eclipse.org/smila/record" version="1.0">
  <Id xmlns="http://www.eclipse.org/smila/id" version="1.0">
    <!-- Element name must be Source, not _Source, it's made due to syntax coloring problem in wiki -->
    <Key name="Path">c:\data\crawler.txt</Key>
  <A n="LastModifiedDate">
      <V t="datetime">2009-02-25 17:44:46.541</V>
  <A n="Path">
  <A n="Filename">
  <A n="Extension">
  <A n="Size">
      <V t="int">36</V>
  <A n="_HASH_TOKEN">

See also