beautypg.com

Index diagnostics – Google Search Appliance Administrative API Developers Guide: .NET User Manual

Page 23

background image

Google Search Appliance: Administrative API Developer’s Guide: .NET

23

Retrieving All Collections

Retrieve a list of collections as follows:

// Send the request and print the response
GsaFeed myFeed = myService.GetFeed("collection");

foreach(GsaEntry myEntry in myFeed.Entries) {

Console.WriteLine("Collection Name: " + myEntry.GetGsaContent("entryID"));
Console.WriteLine("Follow URLs: " + myEntry.GetGsaContent("followURLs"));
Console.WriteLine("Do Not Crawl URLs: " + myEntry.GetGsaContent

("doNotCrawlURLs"));
}

Retrieving a Collection

Retrieve the attributes of a single collection as follows:

// Send the request and print the response
GsaEntry myEntry = myService.GetEntry("frontend", "default_collection");
Console.WriteLine("Follow URLs: " + myEntry.GetGsaContent("followURLs"));
Console.WriteLine("Do Not Crawl URLs: " + myEntry.GetGsaContent

("doNotCrawlURLs"));

Updating a Collection

Update the attributes of a collection as follows:

// Create an entry to hold properties to update
GsaEntry updateEntry = new GsaEntry();

// Add properties to updateEntry
updateEntry.AddGsaContent("followURLs", "http://good/");
updateEntry.AddGsaContent("doNotCrawlURLs", "http://frequent/");

// Send the request
myService.UpdateEntry("collection", "default_collection", updateEntry);

Deleting a Collection

Delete a collection as follows:

myService.DeleteEntry("collection", "new_collection");

Index Diagnostics

List crawled documents and retrieve the status of documents in a search appliance using the
diagnostics feed.