Search contexts

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

Search contexts

A standard database search can be specified using the searchContext element which groups together a search query specification with a search form and ways of displaying the results. The search results generated must contain only database objects. For searches that return nav: based elements such as nav:keyword use the navSearchContext element.

Example

Here is an example of search context configuration:

<I4Config

 xmlns:ssc="http://www.teradp.com/schemas/GN4/1/StandardSearchControls.xsd"

 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

 . . .

 <searchContexts>

   <searchContext

    name="Pages"

    objectTypeNames="page"

    iconName="icon-file"

    tableStyleList="PageList"

    gridStyleMediumIcons="MediumIcons"

    defaultStyle="gridStyleMediumIcons">

     <searchForm>

       <ssc:and>

         <ssc:textbox

          path="@number"

          operators="Equal" />

         <ssc:calendar

          path="gn4:editionRef/nav:refObject/gn4:edition/@date"

          label="date" />

         <ssc:dropDownObjects

          path="gn4:workstateRef/@idref"

          xquery="gn4:workstate[gn4:levels/gn4:in='Page']"

          operators="Equal NotEqual" />

         <ssc:dropDownObjects

          path="gn4:sectionRef/@idref"

          xquery="gn4:section" />

         <ssc:dropDownObjects

          path="gn4:zoneRef/@idref"

          xquery="gn4:zone" />

       </ssc:and>

     </searchForm>

   </searchContext>

   . . .

 

Properties

searchContext/@name

Name of the search context, as it is referenced by I4Config/sideBars/sideBar/searchContextRef/@name. It identifies the search context: it is mandatory and must be unique. Inside the navigation bar and in the header of the associated result widget, it is translated using StringScope.Default.

searchContext/@objectTypeNames

Space separated list of the type of the objects that can be displayed with the search context. It is mandatory.

searchContext/@iconName

Name of the icon associated to the search context. That icon is displayed in both the navigaton bar and in the header of the associated result widget.

searchContext/@spikedHandling

The spike handling of the search, can be Exclude, Include or Only.

Exclude – only returns non spike objects, this is the default.

Include – list all objects in the search

Only – only returns spiked objects

searchContext/@tableStyleXXX, searchContext/@gridStyleXXX and searchContext/@defaultStyle

The result widgets associated to the search context are rendered using a directory style among the ones referenced by the attributes:

-searchContext/@tableStyleCompactList

-searchContext/@tableStyleList

-searchContext/@tableStyleDetails

-searchContext/@gridStyleSmallIcons

-searchContext/@gridStyleMediumIcons

-searchContext/@gridStyleLargeIcons

The tableStyleXXX attributes above must match the name of a table directory style (i.e. attribute I4Config/tables/table/@name) while the gridStyleXXX attributes must match the name of a grid directory style (i.e. attribute I4Config/tiles/tile/@name).

At least one of the attributes above must be configured. In the case of more than one is configured, the user will be able to select in a combo box the directory style to be used for rendering the result list. The entries of that combo box is filled by the name of the attribute (tableStyleDetails, tableStyleList, gridStyleSmallIcons, etc…) translated using StringScope.DirectoryStyle(i.e. “Details”, “List”, “Small Icons”, … in the English standard configuration).

Among the tableStyleXXX and gridStyleXXX attributes, the one used by default is indicated by the attribute defaultStyle. If it is not set, or if it is set to the name of an attribute that is not set, then the style applied by default will be the one indicated by the first attribute set among (in this order) tableStyleCompactList, tableStyleList, tableStyleDetails, gridStyleSmallIcons, gridStyleMediumIcons and gridStyleLargeIcons.

See Directory styles chapter for details concerning the configuration of directory styles.

searchContext/searchForm

Configuration of the search form that popups when clicking the search icon on the header bar of the result widget in order to filter the results list. It is optional and, when configured, must contain one and only one search control element (any available element in the http://www.teradp.com/schemas/GN4/1/StandardSearchControls.xsd namespace, i.e. dropDownObjects, textBox, etc…).

See Search controls chapter for details concerning the configuration of search controls.