Search template

From VYRE

Jump to: navigation, search

Contents

Overview

Search Templates are JSP files that control the interface that users use to search through collection schemas using the Template search input portlet. A JSP tag library is used to help build the form that which users see. They are similar to Content templates and Bulk edit templates.

Search templates were introduced into Unify in version 4.4. They can be found in Publishing module -> Files -> Code templates -> Search templates.

The Unify "VYRE search" tag library

vyre-search:default-input

This tag will produce an input box for searching on all indexed fields. The following attributes can be used in this tag:

  • labelText - Optional label text for the generated input field (overrides the default value)
  • inputClass - HTML class values to add to the input field (since: 4.7)

vyre-search:metadata

This tag will produce an input box for searching on the default metadata fields. The following attributes can be used in this tag (name HAS to be specified):

  • name - [name/description/keywords] the name of the metatdata attribute to use.
  • labelText - Optional label text for the generated input field (overrides the default value)
  • inputClass - HTML class values to add to the input field (since: 4.7)

vyre-search:date-range

This tag will produce a ranged input for searching on the createion or modification date. The following attributes can be used in this tag (field HAS to be specified):

  • field - [creation/modification] - Creates a search input field for searching create or modify date ranges.
  • startLabel - Optional label text for the generated start input field (overrides the default value).
  • endLabel - Optional label text for the generated end input field (overrides the default value).
  • showTime - [true/false] Defaults to true. When set to false, time will not be displayed in the input boxes.
  • cssName - Adds css class to start and end element (since 4.6.3.3)

vyre-search:taxonomy

This will produce either a drop down list or category tree for searching on taxonomy. Please note that this tag will developed further in future versions of Unify. The following attributes can be used in this tag:

  • renderer: [tree/dropdown] - this is the input mode. If "tree" is specified, then taxonomy tree will be displayed. If "dropdown" is specified, then dropdown select list will be displayed (since Unify 4.7).
  • labelText - Optional label text for the generated input field (overrides the default value)
  • rootCategories - A comma separated list of IDs of categories that should be displayed at the first level in the tree.
  • linkPath - the linkpath from the store the results will be from to the store you wish to search on.
  • inputClass - HTML class values to add to the input field (since Unify 4.7). Note this is only used in dropdown mode.

LinkPaths must be defined according to the following syntax:

 linkPath 	:= "link_"[linkId]("/"[linkPath])?

where linkId is an id of a link definition.

vyre-search:attribute

This tag will produce an input box for search on any metadata or content attribute fields. The following attributes can be used in this tag (attributePath MUST be specified):

  • labelText - Optional label text for the generated input field (overrides the default value)
  • rangeQuery - [true/false] defaults to false. Whether the input should be a range input. A range input will generate two input boxes. Below is a list of attributes that allow you to customise an attribute using range query:
    • startLabel - Text to append to the label of the start of the range (default: after)
    • endLabel - Text to append to the label of the end of the range (default: before)
    • showTime - [true/false]. Defaults to true. Only applicable when the attribute this tag relates to is searching on a 'time and date' field. If this is set to false, the time will not be displayed. Note, you cannot set show time to true when search on a date only field.
  • inputClass - HTML class values to add to the input field (since: 4.7)


  • attributePath - the path from the store the results will be from to the store you wish to be searching on.

This must be defined according to the following syntax:

 attributePath 	:= "attribute_"[attId] | "link_"[linkId]"/"[attributePath]

where

- linkId is an id of a link definition

- attId is an id of an attribute definition or name, description, keywords, creationDate, lastModifiedDate, creator or lastModifier.

For example, if you wanted to an include an attribute with an ID of 999, the tag would be:

 <vyre-search:attribute attributePath="attribute_999" />

To search on a linked item's name you would use (where 123 is the link ID)

 <vyre-search:attribute attributePath="link_123/attribute_name" />

You can also nest these such as:

 <vyre-search:attribute attributePath="link_281/link_562/attribute_1148" labelText="Number of units" />

vyre-search:item-link

This will produce a select box for searching by which items an item is linked to. The following attributes can be used in this tag (linkDefinition HAS to be specified):

  • labelText - Optional label text for the generated input field (overrides the default value)
  • linkDefinition - the ID of the link definition to search on.
  • linkDefinitionTitle - the unique title of the link definition to search on. since 4.8
  • useCurrentItem - [true/false]. Defaults to false. If this is set to true, the input is not displayed and the search will look for items linked to the currently displayed item.
  • multiple - [true/false]. Defaults to false. Choose weather or not to use a multi select box. Set to either one or multiple.
  • filterType [all/savedSearch:[id] where [id] is the id of a saved search]. Defaults to all. If a saved search is used, the options will be limited to the results of that saved search.
  • sortLocale - The locale that items should be sorted by. If no locale is specified, the locale which the page is being rendered in will be used.
  • optionDisplay - Defaults to $item.name. Expression used to display the item options in the select box. Use velocity syntax, available variables are item, itemDocument and itemMap.
    • An example of how to use the itemMap is:
$itemMap.get('att1023')
  • inputClass - HTML class values to add to the input field (since: 4.7)

Note the the values are retrieved from the index. In order to retrieve these values, the value must be stored in the index (rather than the value just being indexed). See Content_attribute#Index_options for more information. Also be aware that if the value does not exist in the index, the String "$itemMap.get('att1023')" will be printed in the place of the value. In order to avoid this, you can use something like:

 #if ($itemMap.get('att1023')) $itemMap.get('att1023') #else No value supplied #end

vyre-search:user-link

This will produce a select box for searching by which users an item is linked to. The following attributes can be used in this tag (linkDefinition HAS to be specified):

  • labelText - Optional label text for the generated input field (overrides the default value)
  • linkDefinition - the ID of the user link definition to search on.
  • linkDefinitionTitle - the unique title of the user link definition to search on. since 4.8
  • useCurrentUser - [true/false]. Defaults to false. If this is set to true, the input is not displayed and the search will look for items linked to the currently logged in user. If no user is logged in, this tag will not filter the search results.
  • multiple - [true/false]. Defaults to false. Choose weather or not to use a multi select box. Set to either one or multiple.
  • filterType - [all/group:[id]/profile:[id] where [id] is a id of a static user group or profile group respectively]. Defaults to all. If a static group or profile group is used, the results will be limited to users from that group.
  • optionDisplay - Defaults to $user.fullName. Expression used to display the user options in the select box. Use velocity syntax, available variables are user, profile and properties (a map).
  • sortLocale - The locale that items should be sorted by. If no locale is specified, the locale which the page is being rendered in will be used.
  • inputClass - HTML class values to add to the input field (since: 4.7)

vyre-search:search-button

This will produce the submit button for the search form. The following attributes can be used in this tag:

  • labelText - Optional label text for the generated input field (overrides the default value).
  • inputClass - HTML class values to add to the button (since: 4.7)

vyre-search:locale

This tag will generate a select box for search on an items locale. The following attributes can be used in this tag (inputType HAS to be specified):

  • labelText - Optional label text for the generated input field (overrides the default value)
  • inputType - [useSite/userSelected]. When set to useSite no input field is displayed and the render locale is automatically used, otherwise a list of locales is displayed.
  • localesOptions - Only applicable when inputType=userSelected. A comma seperated list of the the user should be able to choose from.
  • inputClass - HTML class values to add to the input field (since: 4.7)

Including another search template

Template:Rellink

Personal tools