beautypg.com

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

Page 38

background image

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

38

Use the following properties to access related queries.

Note: A related query configuration rule is in the following format:

Search_Terms,Related_Queries

The Search_Terms and the Related_Queries values cannot be empty. The related query configuration
rules conform to the CSV format, which uses commas to separate values.

Retrieving Related Queries

Retrieve related queries as follows:

Dictionary queryMap = new Dictionary();

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

// Send the request and print the response
GsaEntry myEntry = myService.QueryEntry("synonym", "myFrontend", queryMap);

foreach(KeyValuePair kvp in myEntry.GetAllGsaContents()) {

if (Regex.IsMatch(kvp.Key, @"^\d+$")) {

Console.WriteLine("The line " + kvp.Key + " is: " + kvp.Value);

}

}

Property

Description

line number

The line number of the related query configuration rule (in all the rules).

newLines

The new related query configuration to add. This value may include
multiple lines of related query statements. The delimiter is \n.

numLines

The total number of result lines.

originalLines

The original related query configuration to change. This value may
include multiple lines of related query statements. The delimiter is \n.

startLine

The starting line number of the related query configuration to change.
The minimum value is 0.

updateMethod

The method to use to change related query configurations.

Possible values are:

update. Updates part of the related query configuration table to
the new configuration. Deletes related query configurations using
the update method. See the example that follows.

append. Adds a new related query configuration to the end of the
synonym configuration table.

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