beautypg.com

Query suggestion blacklist, Query suggestion refresh – Google Search Appliance Administrative API Developers Guide: .NET User Manual

Page 40

background image

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

40

Query Suggestion Blacklist

The query suggestion blacklist supports the /suggest feature described in the “Query Suggestion Service
/suggest Protocol” chapter of the Search Protocol Reference. This feature uses the suggest feed to
retrieve and update the query suggestion blacklist entries.

The query suggestion blacklist supports the regular expressions in the re2 library (

http://

code.google.com/p/re2/wiki/Syntax

). If you want specify an exact match, you need to use the following

syntax:

^the_word_to_match$

Retrieving Query Suggestion Blacklist Information

Retrieve query suggestion blacklist information as follows:

// Create a GsaClient
GsaClient client = new GsaClient("SearchAppliance", 8000, "username",

"password");

// Get and print the current content of the blacklist file
GsaEntry entry = client.GetEntry("suggest", "suggestBlacklist");
Console.WriteLine("Current content: " + entry.GetGsaContent("suggestBlacklist"));

Updating Query Suggestion Blacklist Entries

Update query suggestion blacklist entries as follows:

// Update the content
entry = new GsaEntry();
entry.AddGsaContent ("suggestBlacklist",

"bad_word_3\n^bad_word_1$\ncar[0-9]{4}.*\n");

client.UpdateEntry("suggest", "suggestBlacklist", entry);

Query Suggestion Refresh

The query suggestion refresh supports the /suggest feature described in the “Query Suggestion Service
/suggest Protocol” chapter of the Search Protocol Reference. This feature uses the suggest feed to
refresh the query suggestion database.

Refresh query suggestions as follows:

GsaClient client = new GsaClient("SearchAppliance", 8000, "username",

"password");

entry = new GsaEntry();
entry.AddGsaContent ("suggestRefresh", "1");
client.UpdateEntry("suggest", "suggestRefresh", entry);

Property

Description

suggestBlacklist

Content of the suggest blacklist file.

Property

Description

suggestRefresh

Triggers a query suggestion refresh.