Triggering in response to specific keywords – Google Search Appliance OneBox for Enterprise Developers Guide User Manual
Page 10
![background image](/manuals/552759/10/background.png)
Google Search Appliance: Google OneBox for Enterprise Developer’s Guide
10
Triggering in Response to Specific Keywords
Our directory example uses a keyword trigger, directory. A keyword trigger must be the first word of
the user’s search query, so that the search appliance invokes a module when the search query has the
form directory Bill Smith but not when the search query has the form employee directory. You
can specify multiple keywords by separating each word with a pipe symbol, for example,
directory|phone|contact. If you want the keyword trigger to invoke on a word other than the first
word, use a regular expression.
To define a trigger in the XML configuration file, specify the
...
To specify multiple keywords, the
This example shows how you can use multiple keywords to provide abbreviated versions of a keyword
or an alternative keyword.
Triggering When the Query Matches a Regular Expression
If you use a regular expression trigger, a search appliance compares the search query to the regular
expression pattern and invokes the OneBox module if the query and the pattern match. OneBox
supports regular expressions as defined by the Perl Compatible Regular Expressions library (PCRE) at
expressions with a space, for example,
ignores case and matches any word before report.
The table below lists common regular expression rules.
The following are examples of the common regular expression rules:
•
The regular expression status (.*) matches a query if the user types status and a project name.
•
The regular expression distance from (.*) to (.*) matches a query such as distance from
Paris to Rome.
•
The regular expression \d+ matches a query such as 123.
Syntax
Description
(.*)
Match any character zero or more times; that is, match any word
(.?)
Match a single character
(\d+)
Match a digit one or more times
(i)
Ignore case
([a-z]+)
Match lowercase letters one or more times
(?: values)
Match specific keyword values