beautypg.com

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

Page 46

background image

Google Search Appliance: Administrative API Developer’s Guide: Java

46

A list of search log entries will be returned.

GsaFeed myFeed = myClient.getFeed("searchLog");
for(GsaEntry entry : myFeed.getEntries()) {

System.out.println("Entry Name: " + entry.getGsaContent("entryID"));
System.out.println("Report State: " + entry.getGsaContent("reportState"));
System.out.println("Report Creation Date: " +

entry.getGsaContent("reportCreationDate"));

System.out.println("Report Date: " + entry.getGsaContent("reportDate"));
System.out.println("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");
myClient.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

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.