beautypg.com

Retrieving keymatch settings – Google Search Appliance Administrative API Developers Guide: Java User Manual

Page 35

background image

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

35

Use the following properties to set KeyMatch configurations.

Note: The format for a KeyMatch configuration rule is as follows:

Search_Terms,KeyMatch_Type,URL,Title

KeyMatch_Type can be: KeywordMatch, PhraseMatch, or ExactMatch.

Search_Term and URL fields cannot be empty. The KeyMatch configuration conforms to the CSV format,
which uses commas to separate values.

Retrieving KeyMatch Settings

Retrieve KeyMatch settings as follows:

Map queryMap = new HashMap();

// Initialize the query
queryMap.put("query", "myQuery");
queryMap.put("startLine", "0");
queryMap.put("maxLines", "50");

// Send the request and print the response
GsaEntry myEntry = myClient.getEntry("keymatch", "myFrontend");
for (Map.Entry me : myEntry.getAllGsaContents().entrySet()) {

if (me.getKey().matches("\\d+")) {

System.out.println("The lines for " + me.getKey() + " are: " +

me.getValue());

}

}
System.out.println("The number of lines are: " +

myEntry.getGsaContent("numLines"));

Property

Description

line_number

The line_number of the KeyMatch configuration rule.

newLines

The new KeyMatch configuration to update. This value may include multiple
KeyMatch statements. The line delimiter is \n.

numLines

The number of total result lines.

originalLines

The original KeyMatch configurations to change. The value may include multiple
KeyMatch statements. The line delimiter is \n.

startLine

The starting line number of a KeyMatch configuration to change. The minimum
value is 0.

updateMethod

The method to change a KeyMatch configuration.

Possible values are:

update. Updates part of the KeyMatch configuration table to the new
configurations. Delete KeyMatch configurations using the update method.
See the example that follows.

append. Adds a new KeyMatch configuration to the end of the KeyMatch
configuration table.

replace. Deletes all rules in the KeyMatch configuration table and then
appends the new rules that you provide.