Article 6PX1C New search API for Slackware UK for free use

New search API for Slackware UK for free use

by
tadgy
from LinuxQuestions.org on (#6PX1C)
A while ago I created a search API interface to query the content of slackware.uk (which is directly used by the search functionality on the site), and intended to make it publicly available for people to integrate into their own sites once it became a stable interface.

So, if you run your own Slackware related site and would like to have a search facility, you are welcome to use the search API now it's stable.

The API takes up to 3 parameters:
Code:p=X - The URL encoded path relative to the / to search.
q=Y - The URL encoded query string to search for.
l=Z - An integer to limit the number of results returned.All parameters are optional and have sane defaults. l= has an inbuilt limit so the API cannot be hammered to list the entire site.

The URL for the search API is constructed as follows:
Code:https://slackware.uk/cgi-bin/searchapi.cgi?p=X&q=Y&l=ZThe first line of the data returned is a "Status:" indicator (0 = success, 1 = temporary error, 2 = permanent error), and if the status indicates an error, an "Error:" line with the error text is returned next. No other data is returned after an error indication. All lines are null (\0) terminated.

Assuming a status of 0, a null (\0) terminated list of matches is output, proceeded by an indicator of file type:
Code:f /path/to/file\0
d /path/to/directory\0
l /path/to/link\0
o /path/to/othertype\0This allows handling of different file types in your own frontend scripts.

If you're interested in integrating a search into your own site, my code for slackware.uk is available to view here:
https://afterdark.org.uk/git/Website...l/search.shtml

Hope people may find it useful - feel free to ask any questions here if you need help :)
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments