Search portlet

NOTE! As of SiteVision 3, this Search portlet replaces the "old" Search portlet that wasn't using the SiteVision Public API.

The custom Velocity template in this portlet uses the JCR (Java Content Repository, JSR 283) programming model. The SiteVision API is available here

Elements available in the Velocity Context
NameType and Description
requestjavax.portlet.PortletRequest
 The portlet request
portletjavax.jcr.Node
 This portlet. See available properties in table below
jcrSessionjavax.jcr.Session
 The JCR Session
sitevisionUtilssenselogic.sitevision.api.Utils
 The main entry point to all utility classes
velocityEvaluatorsenselogic.sitevision.api.render.velocity.VelocityEvaluator
 A evaluator that can parse Velocity templates or Velocity expressions on the fly
searchResultsenselogic.sitevision.api.search.SearchResult
 The search result that holds all hits
Additional properties available for the portlet element ($portlet)
NameType and Description 
 Search form 
searchFieldSizejavax.jcr.PropertyType.LONG 
 The size of the search form input field 
searchFieldFontjavax.jcr.PropertyType.WEAKREFERENCE 
 The search field font Node (sv:font) 
useTextSearchButtonjavax.jcr.PropertyType.BOOLEAN 
 Whether to use a text button or not (i.e. an image button) 
searchButtonTextjavax.jcr.PropertyType.STRING 
 The i18n:ized search button text (en: "Search") 
searchButtonFontjavax.jcr.PropertyType.WEAKREFERENCE 
 The search button Node (sv:font) 
searchButtonImagejavax.jcr.PropertyType.WEAKREFERENCE 
 The search button image Node (sv:image) 
   
 Auto complete suggestions 
useAutoSuggestionsjavax.jcr.PropertyType.BOOLEAN 
 Whether or not to use auto complete suggestions 
maxAutoSuggestionsjavax.jcr.PropertyType.LONG 
 Max number of autocomplete suggestions 
autoCompleteURLjavax.jcr.PropertyType.STRING 
 The autocomplete suggestion URL to use in Ajax calls 
autocompleteFieldjavax.jcr.PropertyType.STRING 
 What index field to use when extracting auto complete suggestions ("nameField" or "titleField", se Index fields section below) 
   
 Querying 
queryParameterjavax.jcr.PropertyType.STRING 
 The name of the parameter to use when submitting a query 
searchFormTargetPagejavax.jcr.PropertyType.WEAKREFERENCE 
 The Node (typically a sv:page) rendering all templates for a search result 
ajaxQueryBaseURLjavax.jcr.PropertyType.STRING 
 Base URL to use for Ajax querying calls  
isRenderingAjaxResultjavax.jcr.PropertyType.BOOLEAN 
 Whether or not the search result was retrieved via Ajax 
updateResultFunctionNamejavax.jcr.PropertyType.STRING 
 A unique name for the JavaScript update function 
   
 Type restrictions 
includeFilesjavax.jcr.PropertyType.BOOLEAN 
 Whether or not to include files in the search result 
includeImagesjavax.jcr.PropertyType.BOOLEAN 
 Whether or not to include images in the search result 
includePagesjavax.jcr.PropertyType.BOOLEAN 
 Whether or not to include pages in the search result 
includeArticlesjavax.jcr.PropertyType.BOOLEAN 
 Whether or not to include articles in the search result 
includeStructurePagesjavax.jcr.PropertyType.BOOLEAN 
 Whether or not to include structure pages in the search result 
   
 Search failed 
showSearchErrorjavax.jcr.PropertyType.BOOLEAN 
 Whether or not to show search errors or no hits messages 
errorMessagejavax.jcr.PropertyType.STRING 
 An i18n:ized message describing why search could not be executed 
searchErrorFontjavax.jcr.PropertyType.WEAKREFERENCE 
 The search error font Node (sv:font) 
   
 Search result 
showNumberOfHitsjavax.jcr.PropertyType.BOOLEAN 
 Whether or not to show number of hits 
numberOfHitsFontjavax.jcr.PropertyType.WEAKREFERENCE 
 The number of hits font Node (sv:font) 
countThresholdjavax.jcr.PropertyType.LONG 
 Effective hit count threshold (exact count vs. approximate count) 
useDidYouMeanjavax.jcr.PropertyType.BOOLEAN 
 Whether or not to use and show "Did you mean" 
didYouMeanFontjavax.jcr.PropertyType.WEAKREFERENCE 
 The "Did you mean" font Node (sv:font) 
   
 Paging 
usePagingjavax.jcr.PropertyType.BOOLEAN 
 Whether or not to use paging 
hitsPerPagejavax.jcr.PropertyType.LONG 
 Maximum number of hits to display for each paged frame 
pagingFontjavax.jcr.PropertyType.WEAKREFERENCE 
 The paging font Node (sv:font) 
pagingPositionjavax.jcr.PropertyType.STRING 
 Where the paging navigation should be located ("top", "bottom" or "top_bottom") 
ajaxPagingBaseURLjavax.jcr.PropertyType.STRING 
 The base URL to use for Ajax paging calls 
isRenderingAjaxPagingResultjavax.jcr.PropertyType.BOOLEAN 
 Whether or not the paged search result is retrieved via Ajax 
startAtHitjavax.jcr.PropertyType.LONG 
 First hit number for the paged search result 
previousFrameURIjavax.jcr.PropertyType.STRING 
 The relative URL for previous paged frame 
nextFrameURIjavax.jcr.PropertyType.STRING 
 The relative URL for next paged frame 
   
 Highlighting 
useSearchHitHighlightingjavax.jcr.PropertyType.BOOLEAN 
 Whether or not to use search hit highlighting 
searchHitHighlightingTypejavax.jcr.PropertyType.STRING 
 Type of highlighting ("strong" or "em") 
searchHitHighlightingFragsizejavax.jcr.PropertyType.LONG 
 Size (approximated char count) for highlighted fragments 
   
 Index fields 
summaryFieldjavax.jcr.PropertyType.STRING 
 Name of the summary field 
titleFieldjavax.jcr.PropertyType.STRING 
 Name of the title field 
nameFieldjavax.jcr.PropertyType.STRING 
 Name of the name field 
namepathFieldjavax.jcr.PropertyType.STRING 
 Name of the name path field 
urlFieldjavax.jcr.PropertyType.STRING 
 Name of the absolute URL field 
uriFieldjavax.jcr.PropertyType.STRING 
 Name of the relative URL field 
lastPublishedFieldjavax.jcr.PropertyType.STRING 
 Name of the last published field 
sizeFieldjavax.jcr.PropertyType.STRING 
 Name of the size field 
siteFieldjavax.jcr.PropertyType.STRING 
 Name of the site field 
mimetypeFieldjavax.jcr.PropertyType.STRING 
 Name of the mime type field 
   
 Search hits 
showSearchHitNumberingjavax.jcr.PropertyType.BOOLEAN 
 Whether or not search hits should be displayed numbered 
showFileIconsjavax.jcr.PropertyType.BOOLEAN 
 Whether or not a file icons should be displayed for each search hit 
useSearchHitBackgroundColorjavax.jcr.PropertyType.BOOLEAN 
 Whether or not a searchHitBackgroundColor (see line below) are in use 
searchHitBackgroundColorjavax.jcr.PropertyType.WEAKREFERENCE 
 The background color for every odd search hit (sv:color) 
headingFieldjavax.jcr.PropertyType.STRING 
 What field to fetch the heading text from ("nameField" or "titleField", see Index fields section above) 
searchHitHeadingFontjavax.jcr.PropertyType.WEAKREFERENCE 
 The hit heading font Node (sv:font) 
showSearchHitExcerptjavax.jcr.PropertyType.BOOLEAN 
 Whether or not to show hit excerpts 
searchHitExcerptFontjavax.jcr.PropertyType.WEAKREFERENCE 
 The hit excerpt font Node (sv:font) 
searchHitExcerptLengthjavax.jcr.PropertyType.LONG 
 Approximate length (char count) for search hit excerpts 
showSearchHitInfojavax.jcr.PropertyType.BOOLEAN 
 Whether or not to show hit info (date + size) 
searchHitInfoFontjavax.jcr.PropertyType.WEAKREFERENCE 
 The hit info font Node (sv:font) 
showSearchHitPathjavax.jcr.PropertyType.BOOLEAN 
 Whether or not to show a linked path to the search hit 
searchHitPathFontjavax.jcr.PropertyType.WEAKREFERENCE 
 The hit path font Node (sv:font) 
   
 Misc 
useCustomSortFieldsjavax.jcr.PropertyType.BOOLEAN 
 Whether or not to use custom sort fields (i.e. use a custom "relevance" sorting") 
useCustomIndexjavax.jcr.PropertyType.BOOLEAN 
 Whether or not a custom index is used 
   
 Aggregated portlet preferences/settings: 
templatesjavax.jcr.PropertyType.WEAKREFERENCE 
 A temporary Node holding all sub-templates used by the main template. See available properties in table below 
bundlejavax.jcr.PropertyType.WEAKREFERENCE 
 A temporary Node holding all i18n:ized texts used for output. See available properties in table below 
Properties available for the templates Node
NameType and Description 
searchFormTemplatejavax.jcr.PropertyType.STRING 
 The search form Velocity template 
searchFormScriptTemplatejavax.jcr.PropertyType.STRING 
 The search form script Velocity template 
didYouMeanTemplatejavax.jcr.PropertyType.STRING 
 The Did you mean Velocity template 
hitCountTemplatejavax.jcr.PropertyType.STRING 
 The hit count Velocity template 
pagingTemplatejavax.jcr.PropertyType.STRING 
 The paging Velocity template 
pagingScriptTemplatejavax.jcr.PropertyType.STRING 
 The paging script Velocity template 
hitsTemplatejavax.jcr.PropertyType.STRING 
 The search hits Velocity template 
noHitsTemplatejavax.jcr.PropertyType.STRING 
 The no hits/search error Velocity template 
Properties available for the bundle Node
NameType and Description 
searchTipTextjavax.jcr.PropertyType.STRING 
 The i18n:ized search tip text (en: "To find what you are looking for, try one of the following:") 
checkSpellingTextjavax.jcr.PropertyType.STRING 
 The i18n:ized check spelling text (en: "Check spelling.") 
useGenericTextjavax.jcr.PropertyType.STRING 
 The i18n:ized use generic text (en: "Use less words or more common words.") 
useSynonymTextjavax.jcr.PropertyType.STRING 
 The i18n:ized use synonym text (en: "Try a synonym or a similar term.") 
useWildcardTextjavax.jcr.PropertyType.STRING 
 The i18n:ized use wildcard text (en: "Use an asterisk to find other word endings. If you want to search for web<em>site</em> and web<em>page</em>, use web*.") 
searchHereTextjavax.jcr.PropertyType.STRING 
 The i18n:ized search here text (en: "Search here") 
numberOfHitsTextjavax.jcr.PropertyType.STRING 
 The i18n:ized number of hits text (en: "Number of hits:") 
youSearchedForTextjavax.jcr.PropertyType.STRING 
 The i18n:ized you searched for text (en:"You searched for:") 
didYouMeanTextjavax.jcr.PropertyType.STRING 
 The i18n:ized did you mean text (en: "Did you mean:") 
lastModifiedTextjavax.jcr.PropertyType.STRING 
 The i18n:ized last modified text (en: "Last modified:") 
sizeTextjavax.jcr.PropertyType.STRING 
 The i18n:ized size text (en: "Size:") 
previousTextjavax.jcr.PropertyType.STRING 
 The i18n:ized previous text (en: "Previous") 
nextTextjavax.jcr.PropertyType.STRING 
 The i18n:ized next text (en: "Next") 
showingHitTextjavax.jcr.PropertyType.STRING 
 The i18n:ized showing hit text (en: "Showing hit") 
showingHitsTextjavax.jcr.PropertyType.STRING 
 The i18n:ized showing hits text (en: "Showing hits") 
ofTextjavax.jcr.PropertyType.STRING 
 The i18n:ized of text (en: "of") 
noHitsPatternTextjavax.jcr.PropertyType.STRING 
 The i18n:ized and parameterized no hits text (en: "Your search <strong>{0}</strong> did not match any documents") 
searchPhraseHitCountPatternTextjavax.jcr.PropertyType.STRING 
 The i18n:ized and parameterized phrase/count text (en: "Your search <strong>{0}</strong> resulted in <strong>{1}</strong> {1,choice,0#hits|1#hit|2#hits}") 

Denna sida publicerades: 2012-05-10

Skriv ut PDF-avsnitt

Hjälpte informationen på den här sidan dig?

Missa inga nya rön, tips och tricks! Prenumerera på insite!

Find us!

SiteVision AB (Headquarter)
Vasagatan 10
702 10 Orebro
Sweden

Info: +46 19-17 30 30
Support: +46 19-17 30 39

Latest Tweets