Search

Build 1501 on 14/Nov/2017  This topic last edited on: 22/Mar/2016, at 17:02

Description

Search for objects in the database matching search conditions and return the results as xml.

Parameters (* denotes an optional parameter)

Name

This mandatory string parameter contains the name of a configuration loaded in the database, as search_Name, that contains the search conditions.

Pars*

Optional parameters used to replace variable parts in the search conditions and passed to the XSL transformation used to generate the objects XML (if any). Parameters are constructed as a list of name-value pairs in the format 'name1:value1;name2:value2...'; For example, 'folderId:30;author:smith' defines a 'folderId' parameter with value 30 and a 'author' parameter with value 'smith'.

From*

An integer value specifying the index of the first object to return, where the first object returned by the search has an index of '0'. For non-full text searches, this parameter is optional. The default value is 0. For full text searches, the value of from MUST be set to 0 on the first query in a session.

See Example 4

Count (Optional when performing non-full text searches)

An integer value indicating the number of objects to return, optional for non-full text searches. If this parameter is not specified, or it's value is set to zero, the command returns all of the objects from the first requested one.  For full text searches, Count is mandatory. It is the number of results to return in the query.

Feed*

An optional name of a feed configuration (XML export options) to use to generate the returned objects' XML. If not specified, results are returned using the default XML export options, i.e., in the format of the native navigator XML.

Context*  (Valid only for full text searches)

A compressed list of previous query parameters, i.e., the search history valid only for full-text searches. It is used along with the RefinementId to perform new actions on a given set of results.

RefinementId* (Valid only for full text searches)

An optional parameter that contains a refinement id from the <categories> node of the results, valid only for full-text searches. For example:

<Category type="Source" id="cSource/16867630274464995265" title="story" occurrences="0" state="Displayed" />

where the refinement id = cSource/16867630274464995265.

The refinement id is used along with the Context to filter the search results, that is, to request a subset of the total results returned. The refinementId is prefixed with a refinement option, '+' for include, '-' for exclude, and empty to clear previous refinements.

NOTE: only one refinementId can be specified for each query.

See Example 7

SuggestionQuery*  (Valid only for full text searches)

In certain cases, the a full-text search will return a <Suggestion> node in the results, for example, when a word has been misspelled. Use this optional parameter to redo the query using the suggested term.

See Example 8

 

NOTE:A successful Search REST call always returns searchResult as the first node as shown in the picture below. This node contains the total number of objects matching the search criteria, as 'n', and the number of results returned, in the 'from' and 'count' attributes. When the value of from was 0, and the count parameter was not specified, the number of results and the count are equal.

<?xml version="1.0" encoding="utf-8" ?>

<result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      xmlns:xsd="http://www.w3.org/2001/XMLSchema"

      xmlns="http://www.teradp.com/schemas/GN4/1/Results.xsd">

 <searchResult n="2" from="0" count="2" queryTimeSpan="0">

 

NOTE ALSO: Executing the REST call without the required parameter(s) results in an error, e.g., the one shown below:

<?xml version="1.0" encoding="utf-8" ?>

<result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      xmlns:xsd="http://www.w3.org/2001/XMLSchema"

      xmlns="http://www.teradp.com/schemas/GN4/1/Results.xsd">

   <error code="1903" name="SearchMissingParameter"
          message="Search conditions: missing parameter 'Count' (ERR1903)" />

 

See: Working with Searches