12.6 Search Result Variables

The following table lists all available search result variables that can be used in addition to the global template variables to extend the functionality of the default search result templates or to create new templates.

For more information about how to customize templates, see Section 11.0, Understanding Templates and Section 13.0, Customizing Your Templates and Search Forms.

Table 12-3 Search Result Variables

Variable Name

Description

$$Author

Name of the original author of a document returned in a hit.

$$BeginAuthorized

Begins a section for a search result that the user has rights to see. Used in conjunction with $$EndAuthorized. If a search result is authorized, this section of text and template variables is processed. If it is unauthorized, this section is removed from the output.

See also $$BeginUnAuthorized.

$$BeginBestBet

Begins a repetitive section that is processed for each best bet search result item.

Result detail variables, such as $$Title, $$Description, $$Index, and $$Relevance, can be used within this section.

See also $$EndBestBet.

$$BeginUnAuthorized

Begins a section for a search result that the user does not have rights to see. Used in conjunction with $$EndUnAuthorized. If a search result is not authorized, this section of text and template variables is processed. If the search result is authorized, this section is removed from the output.

See also $$BeginAuthorized.

$$DateTime[date_format]

The date and time of a hit. This is automatically written in the Java “medium” date format using the client’s locale (all calendars, translations, and date and time formats are observed).

$$DateTime[ ] can use an optional date and time format provided within the brackets [ ]. The text should conform to the Java DateFormat syntax.

$$Description

Abstract, description, or first 255 display bytes of the result item.

$$Encoding

Character set encoding of the current search result item.

$$EndAuthorized

Ends a section for a search result that the user has rights to see. For more information, see $$BeginAuthorized.

$$EndBestBet

Ends the $$BeginBestBet section, which is used to display best bets results. See $$BeginBestBet.

$$EndUnAuthorized

Ends a section for a search result item that the user does not have rights to see. For more information, see $$BeginUnAuthorized.

$$FileFormat

Indicates a specific document type. For example, HTML, Word 97, or PowerPoint.

HINT:You can control the text output for each file format by using the optional FileFormats.properties file. For more information, see the Novell QuickFinder Server File Formats page.

$$FirstHit

Hit number of the first item in the current result page. Displayed using the client’s locale.

$$HighlightURL[text]

If the source document of a search result is capable of being highlighted (HTML or text files), then the text contained within the brackets is displayed. This variable can be used as a marker to identify which of the search results can display highlighted search terms. Typically, $$HighlightURL is also included within the brackets and thereby outputs the URL to be used to highlight the current document.

$$Index

Name of the index in which a particular search result item was found.

$$IsExpandedSearch[text]

Displays a message indicating when a set of results was produced from expanded search indexes. The message is placed between the brackets [ ] and might read something like The query you were looking for was not found in the selected indexes. The displayed search results were produced from additional search indexes.

$$Language

Language of the result item. $$Language is displayed in the language of the client’s locale.

$$LastHit

Hit number of the last item in the current result page. Displayed using the client’s locale.

$$MoreHits[page#, text]

Conditional text section to be included only if there are additional hits in the search results that can be retrieved.

If the first section of the conditional text contains a number followed by a comma (for example: $$MoreHits[3, text to be included]), the server first determines if the designated search results page exists. If page# is missing, 1 (the next page) is assumed. If the designated page is available, the remaining text after the comma and up to the closing bracket is written to the result page.

The initial number is relative to the current page. That is, -1 references the page immediately before the current page and 1 references the page immediately after. Zero (0) refers to the current page.

$$MoreHitsURL[page_number]

URL needed to display another page of search results. The optional parameter identifies the desired search result page number. If it is not provided, 1 is assumed. The page number is relative to the current page. That is, -1 refers to the page immediately before the current page and 1 references the page immediately after. Zero (0) refers to the current page.

The URL is inserted only if the designated page exists.

$$Number

Hit number of the current result item. Possible numbers begin with 1 and end with $$TotalHits. Displayed using the client’s locale.

$$PageNum[page#]

Page number corresponding to the current search results page. This variable is used when more search results are available than can fit on one page (such as when $$TotalHits is greater than the number of hits specified per page in the &numhits=# query parameter).

The optional page# identifies the relative page from the current result page. That is, -1 refers to the page immediately before the current page and 1 references the page immediately after. Zero (0) refers to the current page.

The page number is inserted only if the designated page exists.

$$PrintURL[first_hit_number, number_of_hits]

URL used to print the hits listed on the current search result page.

The optional parameters can be specified to define the beginning search result number and the number of search results to include in the print job.

The number_of_hits parameter can use the $$TotalHits template variable.

$$Relevance

How closely the result matches the user’s query, indicated by percentages (1% to 100%).

$$SearchFor[number]

Query entered by the client into the search field. See $$Query[number] for more information.

$$SearchTime

Amount of time used to process the current search request. $$SearchTime is displayed using the client’s locale.

$$Size

Size of the data pointed to by the result item’s URL. Displayed using the client’s locale.

$$SortByDate

Returns True or False depending on the &sortbydate=true_false query parameter.

$$SortByURL[sortfield.sortorder ...]

The URL used to show the current result page sorted by one or more search result fields.

Sort field names include title, author, changedate, filelength, language, summary, relevance, url, index, format, and document_number.

Optional sort orders include ascending and descending.

Sort field and sort order names are separated by a period.

Multiple sort fields are separated by a space.

$$Title

If a title is not available in documents being searched, $$URL is used instead; if the URL is unavailable, < title unavailable > is used.

$$TotalHits

Total number of hits that match the search query. This is not the same as the number of hits displayed in any particular result page. Displayed using the client’s locale.

$$URL

URL of the result item.