Pattern API

This API is deprecated, please refer to the new RESTFul API instead.


The Pattern API is the interface to insert/update patterns in the OpenSearchServer web crawler.


  • use (required): The name of the index.
  • login (optional): The login parameter. This becomes required once you create a user.
  • key (optional): The key parameter related to the login (api key). This becomes required once you create a user.
  • deleteAll: The command to perform: create, stop, start.
  • type: The type parameter is used to select the type of the pattern. There are two types:
    • exclusion
    • inclusion

If no type is specified, it is assumed to be an inclusion.

Posting a text file

One easy way to manage the pattern list is to upload a text file using a post or a put http request. Here is a typical example (one pattern per line) :

  • - if you only want to crawl the home page
  •* - if you want to crawl all the content
  •*wiki* - if you only wish to crawl URLs containing the word "wiki" within the domain.**

The next step is posting the file using a post or a put HTTP request.
In our example we'll use CURL:

curl -o log.out -T patternlist.txt "http://localhost:9090/pattern?use=indexname&deleteAll=yes"

Using PHP

The PHP client classes can be found in the SVN directory:

$oss = new OssApi('http://localhost:9090', 'index1');

Pushing a single pattern:


Multiple patterns:


Replacing the crawler patterns with the ones stored in a text file (one per line):

$oss->pattern(file_get_contents('patternlist.txt'), true);

View/edit on GitHub

comments powered by Disqus