beautypg.com

Listing a search log, Creating a search log, Retrieving a search log – Google Search Appliance Administrative API Developers Guide: .NET User Manual

Page 45

background image

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

45

Listing a Search Log

List search log entries by sending an authenticated GET request to the root entry of the searchLog
feed.

A list of search log entries will be returned.

GsaFeed myFeed = myService.GetFeed("searchLog");
foreach(GsaEntry entry in myFeed.Entries) {

Console.WriteLine("Entry Name: " + entry.GetGsaContent("entryID"));
Console.WriteLine("Report State: " + entry.GetGsaContent("reportState"));
Console.WriteLine("Report Creation Date: " +

entry.GetGsaContent("reportCreationDate"));

Console.WriteLine("Report Date: " + entry.GetGsaContent("reportDate"));
Console.WriteLine("Is Final: " + entry.GetGsaContent("isFinal"));

}

Creating a Search Log

Create a new search log entry by sending an authenticated POST request to the root entry of the
searchLog feed.

A new search log entry will be generated and returned.

GsaEntry insertEntry = new GsaEntry();
insertEntry.AddGsaContent("reportName", "bbb");
insertEntry.AddGsaContent("collectionName", "default_collection");
insertEntry.AddGsaContent("reportDate", "date_3_25_2009");

myService.InsertEntry("searchLog", insertEntry);

Retrieving a Search Log

Check the search log status and get search log content by sending an authenticated GET request to the
search log entry of the searchLog feed using the following query parameters.

Parameter

Description

collectionName

Collection name of a search log. The default value is
all.collections.

Parameter

Description

query

Query string for the logContent. The logContent contains many lines
of logs. The query string applies to each line, and only lines that contain
the query string are returned.

maxLines

The maximum logContent lines to retrieve. The default value is
50 lines.

startLine

The first logContent lines to retrieve. The default value is 1 line.