Creating crawls

Use the IasCrawler.createCrawl() method to create a new crawl of any type (for example, file system, delimited file, or custom data source).

The syntax of the method is:
IasCrawler.createCrawl(CrawlConfig crawlConfig)

The crawlConfig parameter is a CrawlConfig object that has the configuration settings of the crawl.

To create a new crawl:

  1. Make sure that you have created a connection to the IAS Server.
  2. Instantiate a CrawlId object and set the Id for the crawl in the constructor.

    You can create an ID with alphanumeric characters, underscores, dashes, and periods. All other characters are invalid for an ID.

    For example:
    // Create a new crawl ID with the name set to Demo.
    CrawlId crawlId = new CrawlId("Demo"); 
  3. Instantiate a CrawlConfig object and pass in the CrawlId object .
    For example:
    // Create a crawl configuration.
    CrawlConfig crawlConfig = new CrawlConfig(crawlId);
  4. Instantiate a SourceConfig object
    For example:
    // Create source configuration.
    SourceConfig sourceConfig = new SourceConfig();
  5. Set the source properties and seeds in the SourceConfig object. Detailed information on source properties is provided in other topics.
  6. Set the SourceConfig on the CrawlConfig.
    For example:
    // Set source configuration.
    crawlConfig.setSourceConfig(sourceConfig);
  7. Optionally, you can set configuration options for such features as document conversion, logging, and filters for files and directories. Detailed information on these options is provided in other topics.
  8. Create the crawl by calling IasCrawler.createCrawl() and passing the CrawlConfig (the configuration) object:
    For example:
    crawler.createCrawl(crawlConfig);
If the IasCrawler.createCrawl() method fails, it throws an exception:
  • CrawlAlreadyExistsException occurs if a crawl of the same name already exists.
  • InvalidCrawlConfigException occurs if the configuration is invalid. You can call getCrawlValidationFailures() to return the list of crawl validation errors.

To catch these exceptions, use a try block when you issue the method.

If the new crawl is successfully created, it can be started with the IasCrawler.startCrawl() method.