Query modification is the process of modifying a query before it is passed to the configured Watson Explorer Engine backend.
Option | Description |
---|---|
Remove stopwords | You can insert and use this example without making further changes. It removes the English stopwords that are listed in the code. You can add or remove stopwords from the list. |
Call a service | All query modifications enable you to transform the query string before it is passed to Watson Explorer Engine. In the case of calling services, you can submit the query string from end users to a service, which alters it in some way, and then submit that altered string to Watson Explorer Engine. You can insert the example code to call the AlchemyAPI keyword extraction service. The only change you must make to the example code is to supply your AlchemyAPI key, which you must register for. You can receive a key without charge for a certain number of daily transactions. For more information about registering for a key and pricing for AlchemyAPI, see http://www.alchemyapi.com/. The keyword extraction service extracts keywords from the query, similar to what the code for removing stopwords does. But the keyword extraction service does more than remove stopwords. The service applies statistical algorithms and natural language processing to the query term and identifies what it determines are the relevant keywords from the query. Those keywords are then submitted to Watson Explorer Engine as the query term, and searched in your data sources. To see what the AlchemyAPI keyword extraction service considers relevant, you can experiment with the demo at the following URL, http://www.alchemyapi.com/products/demo/alchemylanguage. For example, if you try the query, The US Government Users Restricted Rights, and view the keywords that the service extracts, you see that the keywords are Government Users and Rights. |
Personalize the query to the current user | Although this is not an example in the administration tool because the code is highly dependent on your entity model, you could use query modification to change the query based on the currently logged-in user. The query modification script has access to the following information:
Note: Use query
API methods in the script to access the previous information in the query modification
script. Methods that are part of the query API are suggested automatically in the field while you
type. For example, enter endpoints( in the field, which suggests a list of
available endpoints.
|