The Pugpig Distribution Service has an API that allows server-side search across editions. It's currently available for SDK users who use the Distribution Service. It's powered by Amazon Cloud Search.
URL formats
Search for a keyword across all editions:
http://feed-publication-account.api.pugpig.com/search/all/keyword
Search for a keyword in just one edition (specified by edition ID):
http://feed-publication-account.api.pugpig.com/search/com.account.publication.150515/keyword
To search by article publish date add the date range to the end of the search URL like this:
?sd=2014-10-25T00:00:00Z&
For multiple keywords separate with a '+'
Syntax for category search
Categories are added to the query string like:
cats[0]
cats[1]
etc
A matching document must have ALL the supplied categories
The parameter value must be the category and the value separated by a |
For example: http://schema.pugpig.com/pagetype|pugpig_feature
For example, to find all articles with:
Category: http://schema.pugpig.com/pagetype = "pugpig_feature"
AND
Category: http://schema.pugpig.com/section = "Feature"
After URL encoding it should look like this:
/search/all/-pig?cats[0]=http%3A%2F%2Fschema.pugpig.com%2Fpagetype%7Cpugpig_feature&cats[1]=http%3A%2F%2Fschema.pugpig.com%2Fsection%7CFeature
Excluding categories
In order to completely exclude categories, you can use the same syntax as above but use xcats instead of cats
Sorting your results
By default, results are sorted by relevance. Other options for the sort parameter are:
- score (default) - sort by the document score (i.e. relevance)
- published_date - sorted by published date for the article, most recent first
- edition - sort by edition published date, most recent first. Useful for grouping results by edition
Syntax for page size & pagination
You can specific the page size using &size=XX on the query string, where XX is between 1 and 200. The default is 20
You can specify the first result using "&start=XX" on the query string. The default is 0. So for page 2 with a page size of 20, using start=20.
The information for your paging is returning in the following categories:
<category scheme="http://schema.pugpig.com/search/num_results" term="219"/>
<category scheme="http://schema.pugpig.com/search/result_start" term="2"/>
<category scheme="http://schema.pugpig.com/search/page_size" term="20"/>
Example search feed
http://main-pugpigwebsite-kaldor.api.pugpig.com/search/all/pugpig
Comments
0 comments
Please sign in to leave a comment.