beautypg.com

Related queries – Google Search Appliance Administrative API Developers Guide: .NET User Manual

Page 37

background image

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

37

The following example updates KeyMatch settings:

// Create an entry to hold properties to update
GsaEntry updateEntry = new GsaEntry();
updateEntry.AddGsaContent("updateMethod", "update");

// Set the start line number
updateEntry.AddGsaContent("startLine", 0);

// Provide the original content
string originalLines =

"image,KeywordMatch,http://images.google.com/,Google Image Search\n" +
"video,KeywordMatch,http://www.youtube.com/,Youtube\n" +
"rss feed,PhraseMatch,http://www.google.com/reader,Reader";

updateEntry.AddGsaContent("originalLines", originalLines);

// Prepare new content
string newLines =

",,,\n" +
"video,KeywordMatch,http://video.google.com/,Video Search\n" +
"rss feed,PhraseMatch,http://www.example.com/,RSS example";

updateEntry.AddGsaContent("newLines", newLines);

// Send the request to the search appliance
myService.UpdateEntry("keymatch", "myFrontend", updateEntry);

Note: Delete a setting by changing the statement to three commas (,,,).

The following example replaces KeyMatch settings:

// Create an entry to hold properties to replace
GsaEntry replaceEntry = new GsaEntry();
replaceEntry.AddGsaContent("updateMethod", "replace");

// Prepare new content
string newLines =

"image,KeywordMatch,http://images.google.com/,Google Image Search\n" +
"video,KeywordMatch,http://www.youtube.com/,Youtube\n" +
"rss feed,PhraseMatch,http://www.google.com/reader,Reader";

replaceEntry.AddGsaContent("newLines", newLines);

// Send the request to the search appliance
myService.UpdateEntry("keymatch", "myFrontend", replaceEntry);

Related Queries

Use related queries to associate alternative words or phrases with specified search terms. Related
queries are also known as synonyms. Use the following parameters to search for a query and access
lines from a starting line number and for a maximum amount of lines.

Parameter

Description

query

A query string to perform a full-text search.

startLine

The starting line number of the result, the default value is to start at
line 0.

maxLines

The number of result lines in the response, the default value is 50 lines.