beautypg.com

Keymatch settings, Retrieving the output format xslt stylesheet, Updating the output format xslt stylesheet – Google Search Appliance Administrative API Developers Guide: .NET User Manual

Page 34

background image

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

34

Retrieving the Output Format XSLT Stylesheet

Retrieve the output format stylesheet information from a search appliance as follows:

Dictionary queryMap = new Dictionary();

// Initialize the query map
queryMap.Add("language", "en");
GsaEntry myEntry = myService.QueryEntry("outputFormat", "default_frontend",

queryMap);

Console.WriteLine("Language: " + myEntry.GetGsaContent("language"));
Console.WriteLine("Default Language: " + myEntry.GetGsaContent

("isDefaultLanguage"));

Console.WriteLine("Is the Style Sheet Edited: " + myEntry.GetGsaContent

("isStyleSheetEdited"));

Console.WriteLine("XSLT Stylesheet Content: " + myEntry.GetGsaContent

("styleSheetContent"));

Updating the Output Format XSLT Stylesheet

Update the output format stylesheet information in a search appliance as follows:

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

// The language parameter is passed as part of
// the entry because we cannot use a query parameter
updateEntry.AddGsaContent("language", "en");

// Indicate that the XSLT stylesheet has default values
updateEntry.AddGsaContent("isDefaultLanguage, "1");

// Add this line to update the style sheet content
updateEntry.AddGsaContent("styleSheetContent", "{my new style sheet XSLT}");

// Or add this line to restore the stylesheet content to
// the default, which is mutually exclusive from the previous line
updateEntry.AddGsaContent("restoreDefaultFormat", "1");

// Send the request and print the response
myService.UpdateEntry("outputFormat", "default_frontend", updateEntry);
Console.WriteLine("Output Format: " + updateEntry.GetGsaContent("outputFormat"));
Console.WriteLine("Default Front End: " + updateEntry.GetGsaContent

("default_frontend"));

KeyMatch Settings

KeyMatch settings let you promote specific web pages on your site. The following parameters let you
find KeyMatches by search, and specify a starting line number and the number of lines to access.

Parameter

Description

query

A query string to perform a full text search. For example, if you set
computer in the query parameter, then you get all KeyMatch settings
that contain the word computer.