Skip to content
This repository has been archived by the owner on Oct 24, 2021. It is now read-only.

xp-forge/gsa-xmlfeed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gsa-xmlfeed

Build Status on TravisCI XP Framework Module BSD Licence Required PHP 5.5+ Supports PHP 7.0+ Supports HHVM 3.4+ Latest Stable Version

This API lets you speak to the Google Search Appliance's (GSA) feeding API and manage items on indexes either incrementally or as a whole.

Usage example:

use com\google\gsa\feed\XmlFeed;
use com\google\gsa\feed\FeedType;
use com\google\gsa\feed\ContentRecord;
use com\google\gsa\feed\FeedConnection;
use com\google\gsa\feed\FeedPublishingException;

$feed= new XmlFeed($this->getClass()->getSimpleName(), FeedType::$INCREMENTAL);
foreach ($records as $record) {
  $feed->addRecord('add', new ContentRecord($record['url'], 'text/html',
    '<html><head>'.
    '<title>'.$record['title'].'</title>'.
    '</head><body>'.
    $record['body'].
    '</body></html>'
  ));
}

try {
  (new FeedConnection('http://gsa-test01.example.com:19900/xmlfeed'))->publish($feed);
} catch (FeedPublishingException $e) {
  // Handle
}

API

$ xp -r com.google.gsa.feed
@FileSystemCL<...\xp\gsa-xmlfeed\src\main\php\>
@FileSystemCL<...\xp\gsa-xmlfeed\src\test\php\>
package com.google.gsa.feed {
  package com.google.gsa.feed.unittest

  public enum com.google.gsa.feed.FeedType

  public abstract class com.google.gsa.feed.Record
  public class com.google.gsa.feed.ContentRecord
  public class com.google.gsa.feed.FeedConnection
  public class com.google.gsa.feed.FeedPublishingException
  public class com.google.gsa.feed.UrlRecord
  public class com.google.gsa.feed.XmlFeed
}