beautypg.com

Search status, Query suggestion refresh – Google Search Appliance Administrative API Developers Guide: Java User Manual

Page 41

background image

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

41

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");
System.out.println("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);

Search Status

Retrieve the search status for the search appliance using the servingStatus entry of the status feed.

Property

Description

suggestRefresh

Triggers a query suggestion refresh.

Property

Description

queriesPerMinute

Average queries per minute served recently on the search appliance.

searchLatency

Recent search latency in seconds.