Function: RenderSearchString

Generates a properly formatted searchstring for either SEARCH or DBQUERY

Documentation

RenderSearchString is used to automatically generate the search string, including all user-selected options from RenderBarFilterWithSort.

Parameters
  • FORSEARCH - Specifies search string is to be formatted for %SEARCH{}% rather than the default %DBQUERY{}% format.
  • BASESEARCH - Required - Provides the base search, such as [T]opicType.*value\=.*%BASETOPIC% (for SEARCH) or TopicType = '%BASETOPIC%'" for DBQUERY
  • FACETS - Required Specify what "facets" in include as filters. Defaults to the contents of "Facets" field in base topic.
  • INITSORT -Required Initial sort. set to either "created" or "modified"
  • INITLIMIT - Required Initial results # limit. Set to 10, 20, 50, 100, or all.
  • Note: if you are using this in conjunction with RenderSearchString, you can simplify things by defining FACETS, INITSORT, and INITLIMIT within the base topic.

Css

Implementation

%STARTINCLUDE%%IFDEFINEDTHEN{"%FORSEARCH%" glue="off"}%
~~~  search="
*~~    %BASESEARCH%;
*~~   
%~~    FORMATLIST{"%FACETS%" separator=";" 
~~~          format="$percntIF{ \"$'URLPARAM{$1}'!=''\" then=\"$1.*value\=.*$percntURLPARAM{$1}$percnt\" }$percnt"
~~~    }%" 
~~~   %ELSEDEFINED%
~~~   "%BASESEARCH% 
*~~   
%~~    FORMATLIST{"%FACETS%" separator=" " 
~~~          format="$percntIF{ \"$'URLPARAM{$1}'!=''\" then=\" AND $1 =~ '$percntURLPARAM{$1}$percnt'\" }$percnt"
~~~    }%" 
~~~   %FIDEFINED%
~~~    order="%URLPARAM{"sort" default="%INITSORT%"}%"  
~~~    limit="%URLPARAM{"limit" default="%INITLIMIT%"}%" 
~~~    %IFDEFINEDTHEN{"%URLPARAM{sort}%" glue="off"}%
~~~       reverse="%IFDEFINED{"%URLPARAM{sort}%" as="modified|date" then="on" else="off" glue="off" }%"
~~~    %ELSEDEFINED%
~~~       reverse="%IFDEFINED{"%INITSORT%" as="modified|date" then="on" else="off" glue="off" }%"
~~~    %FIDEFINED%
~~~    %STOPINCLUDE%

Test

"[T]opicType.*value\=.*RenderSearchString " order="modified" limit="%INITLIMIT%" reverse="on"

Calls to 'RenderSearchString'

(C) 2006 LynnwoodBrown@Skyloom.com

This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For more details read the LICENSE.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, to the extent permitted by law; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Middle Fork Home Wiki? Send feedback
Syndicate this site RSS