Pattern API
From OpenSearchServer Wiki
Contents |
Description
API Pattern is the interface to insert/update patterns into the web crawler of the OSS search engine.
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.
Typical content of the text file (open pattern per line):
www.open-search-server.com/* www.open-search-server.fr/*
Then you have to post the file using a post or a put http request. In our example we use curl:
curl -o log.out -T patternlist.txt "http://localhost:8080/oss/pattern?use=indexname&deleteAll=yes"
Parameter list
- use
- The name of the index you want to query.
- deleteAll
- Set yes to replace the old list with the new list. Set no to add the new patterns.
Using PHP
The PHP client classes can be found in the SVN directory: http://opensearchserve.svn.sourceforge.net/viewvc/opensearchserve/trunk/src/php
$oss = new OSS_API('http://localhost:8080', 'index1');
// Push a single pattern
$oss->pattern('http://www.open-search-server.com/*');
// Multiple patterns
$oss->pattern(array(
'http://www.open-search-server.com/*',
'http://nkubz.net/*',
'http://wikipedia.fr/*'
));
// Replace the crawler patterns with the one's stored in a text file (one per line)
$oss->pattern(file_get_contents('patternlist.txt'), true);