Stopping a crawl

Call the IasCrawler.stopCrawl() method to stop a crawl.

The syntax of the method is:
IasCrawler.stopCrawl(CrawlId crawlId)

The crawlId parameter is a CrawlId object that contains the name of the crawl to stop.

To stop a crawl:

  1. Make sure that you have created a connection to the IAS Server. (An IasCrawler object named crawler is used in this example.)
  2. Set the name for the crawl to stop by first instantiating a CrawlId object and then its ID.
    For example:
    // Create a new crawl Id with the name set to Demo.
    CrawlId crawlId = new CrawlId("Demo");
  3. Call the IasCrawler.stopCrawl() method with the crawl ID. To catch an exception, use a try block with the appropriate catch clause.
    For example:
    try {
       crawler.stopCrawl(crawlId);
    }
    catch (CrawlNotFoundException e) {
       System.out.println(e.getLocalizedMessage());
    }

The IasCrawler.stopCrawl() method throws a CrawlNotFoundException if the specified crawl (the crawlId parameter) does not exist or is otherwise not found.

When the stop request is issued, the crawl first goes into a STOPPING state and then (when it finally stops) into a NOT_RUNNING state.

Note: Stopping a crawl means that:
  • The IAS Server produces no record output for the stopped crawl (and all Record Store transactions roll back).
  • Crawl history returns to its previous state before the crawl started.
  • Metrics do not roll back to their state before the crawl started.