Site Search Module The site search module allows users to find content that matters to them on your site. A simple search box (sticker / see below) can be placed anywhere on a page, or in the custom template zones. Search results are ranked and ordered based on a relevance percentage. Site Search Features : - index entire site with once click
- prebuilt index makes for fast search results
- results are ranked based on a relevance percentage occurrence hit value
- simple one click index function
- easy to use search box 'sticker' for inclusion on a page
Here is an example of the search box sticker. Go ahead and try it. Vignette V/5 ErrorError Executing: DEFAULT_ROW DEFAULT_ROW: Unable to find row in table 'proto_clients' matching condition: 'schemaname = 'ybnlive' and sitetype != 'A''
DEFAULT_ROW command reference
Invoked From: template path /proto/plugins/jSearch/jalpha
Error Occurred In Command Block At Lines 14-220:
SET bodytext {
lt;table name=paddPage border=0 cellpadding=0 cellspacing=0 width= quot;[SHOW width] quot; gt;
lt;td width= quot;[SHOW width] quot; gt;
[FORM quot;method=post action=[CURL $_Path 1:10] quot; {
lt;font size= quot;1 quot; gt;Search Terms : lt;/font gt; lt;br gt;
[IF {[SHOW search] == quot; quot;} {
[TEXT FIELD search SIZE 15 MAXLEN 100 VALUE quot;[SHOW search] quot;]
} ELSE {
[TEXT FIELD lsearch SIZE 30 MAXLEN 100 VALUE quot;[SHOW lsearch] quot;]
}]
lt;input type= #39;submit #39; name= #39;bsearch #39; value= #39;search #39; style= #39;height:18px;font-size:10px; #39; gt;
[IF {[SHOW nav] != quot;nav quot;} {
[DEFAULT_ROW proto_clients "url" "schemaname = '[SHOW schema]' and sitetype != 'A'"]
[SET server [FIELD url]]
[IF {[SHOW search] != quot; quot;} {
lt;a href= quot;http://[SHOW server][CURL $_Path #39; #39;] quot; gt; lt;font size=1 gt;New Search lt;/font gt; lt;/a gt;
}]
}]
[# ::: REMOVED cmd / par != quot; quot; ]
[IF {[SHOW search] != quot; quot; || [SHOW lsearch] != quot; quot;} {
[# ::: GET PAGE INFORATION FOR SITE :::]
[IF {[SHOW lsearch] != quot; quot;} {
[SET search [SHOW lsearch]]
}]
[SET search [string trimright $search]]
[# ::: SPLIT UP SEARCH TERMS AND CREATE THE QUERY :::]
[FOREACH term IN $search {
[IF {[SHOW query] != quot; quot;} {
[SET nul [append query { AND UPPER(content) like }]]
} ELSE {
[SET nul [append query { UPPER(content) LIKE }]]
}]
[SET nul [append query #39;%[string toupper $term]% #39;]]
}]
[DEFAULT_ROW $schema.jsearch_index quot;COUNT(*) quot; $query]
[SET total [FIELD COUNT(*)]]
[SET numDisplay 10]
[# ::: GET OID ::: ]
[SET oid_list [split $cmd :]]
[SET low [lindex $oid_list 0]]
[SET high [lindex $oid_list 1]]
[SET MaxHi $total]
[SET nextlow [expr $low + $numDisplay]]
[SET nexthigh [expr $high + $numDisplay]]
[# ::: CHECK FOR HIGH gt; TOTAL]
[IF {$nexthigh gt; $total} {
[SET nexthigh $total]
} ELSE {
[#SET nexthigh $high]
}]
[SET differ [expr $total - $nexthigh]]
[IF {$differ lt; 0} {[SET differ 0]}]
[IF {$differ gt; $numDisplay} {[SET showNext $numDisplay]} ELSE {[SET showNext [SHOW differ]]}]
[IF {[SHOW total] != quot;0 quot;} {
lt;div class= #39;searchresult #39; gt;[SHOW total] Results Found for lt;B gt;[SHOW search][SHOW lsearch] lt;/B gt; lt;/div gt; lt;div class= #39;searchsummary #39; gt;([SHOW low] - [SHOW high] displayed below) lt;/span gt;
lt;p/ gt;
}]
[IF {[FIELD COUNT(*)] gt; 0} {
[SEARCH TABLE $schema.jsearch_index INTO results SQL quot;SELECT * FROM $schema.jsearch_index WHERE $query quot;]
[SET str {}]
[SET max_rel 0]
[FOREACH ROW IN $results {
[SET content [FIELD content]]
[SET pageid [FIELD pageid]]
[SET pagetitle [FIELD pagetitle]]
[SET module [FIELD module]]
[SET sitemaptitle [FIELD sitemaptitle]]
[# ::: Generate Relevance based on population :::]
[SET totRel 0]
[FOREACH term IN $search {
[SET relevant [regsub -all -nocase quot;[SHOW term]. quot; [SHOW content] quot;[SHOW search] quot; test]]
[SET totRel [expr $totRel + $relevant]]
}]
[SET relevant $totRel]
[SET str quot;[SHOW str] {[SHOW relevant]%[SHOW pagetitle]%[SHOW sitemaptitle]} quot;]
[SET last_title [SHOW pagetitle]]
[IF {[SHOW relevant] gt; [SHOW max_rel]} {
[SET max_rel [SHOW relevant]]
}]
}]
[SET str [lsort -dictionary -decreasing $str]]
[SET last_title {}]
[SET count 1]
lt;table cellpadding=0 cellspacing=0 border=0 width= quot;100% quot; gt;
[FOREACH i IN $str {
[SET list_info [split $i %]]
[SET relevant [lindex $list_info 0]]
[SET title [lindex $list_info 1]]
[SET sitemaptitle [lindex $list_info 2]]
[SET var [lindex $list_info 3]]
[IF {[SHOW title] != [SHOW last_title]} {
[IF {([SHOW count] gt;= [SHOW low]) amp; amp; ([SHOW count] lt;= [SHOW high])} {
[SET path [lindex $list_info 2]]
[SET max_rel [expr double($max_rel)]]
[SET relevant [expr double($relevant)]]
[SET relevant [expr round(100 * ($relevant / $max_rel))]]
lt;tr gt;
lt;td class= #39;searchresult #39; valign= #39;top #39; gt;[SHOW count]. amp;nbsp; lt;/td gt;
[IF {[SHOW module] == quot;content quot;} {
lt;td class= #39;searchresult #39; gt;[CURL /html #39;[SHOW title] #39; [SHOW sitemaptitle]] - [SHOW relevant]% matched lt;/td gt;
}]
[IF {[SHOW module] == quot;PR quot;} {
lt;td class= #39;searchresult #39; gt;[CURL /webmc/press/view #39;display|[SHOW pageid] #39; [SHOW title]] - [SHOW relevant]% matched lt;/td gt;
}]
lt;/tr gt;
[#::: GET PAGE SUMMARY :::]
[IF {[SHOW hidesum] != quot;on quot;} {
[IF {[SHOW module] == quot; quot;} {
[SET module content]
}]
[IF {[SHOW module] == quot;content quot;} {
[SET tblname [SHOW schema].content]
[SET fldname bodytext]
[#SET fl2name pagetitle]
[SET fl2name pageid]
}]
[IF {[SHOW module] == quot;PR quot;} {
[SET tblname [SHOW schema].press_releases]
[SET fldname prtext]
[#SET fl2name prheading]
[SET fl2name id]
}]
[#DEFAULT_ROW [SHOW tblname] [SHOW fldname] quot;[SHOW fl2name] = #39;[SHOW title] #39; quot;]
[DEFAULT_ROW [SHOW tblname] [SHOW fldname] quot;[SHOW fl2name] = #39;[SHOW pageid] #39; quot;]
[SET bodytext [FIELD [SHOW fldname]]]
[SET nul [regsub -all { lt;(/?)([^ gt;s]+)s*([^ gt;]*) gt;} $bodytext {} summary]]
[SET PageSummary [string range $summary 0 200]]
lt;tr gt; lt;td gt; amp;nbsp; lt;/td gt;
lt;td class= #39;searchsummary #39; gt;[SHOW PageSummary].. lt;/td gt;
lt;/tr gt;
lt;tr gt; lt;td height= #39;15 #39; colspan= #39;2 #39; gt; amp;nbsp; lt;/td gt; lt;/tr gt;
[SET PageSummary {}]
[SET summary {}]
[SET bodytext {}]
}]
[SET last_title [SHOW title]]
[SET count [incr count]]
} ELSE {
[SET count [incr count]]
}]
}]
}]
lt;/table gt;
[IF {$nexthigh lt;= $total amp; amp; $nexthigh gt; $numDisplay} {
lt;table border=0 cellspacing=5 cellpadding=5 gt;
lt;tr gt;
[SET numLinks [expr $count / $numDisplay]]
[SET ct 1]
[RETAIN search]
lt;td class= #39;searchpagenos #39; gt;[CURL $_Path 1:$numDisplay 1 SAVE_STATE] lt;/td gt;
[WHILE {[SHOW Hi] lt; [SHOW MaxHi]} {
[SET Lw [expr $ct * $numDisplay + 1]] [# ::: 10 ::: ]
[SET Hi [expr $Lw + $numDisplay - 1]] [# ::: 20 ::: ]
[SET ct [incr ct]] [# ::: 2 ::: ]
[IF {$Hi gt; $total} {[SET Hi [SHOW total]]}]
lt;td class= #39;searchpagenos #39; gt;[CURL $_Path [SHOW Lw]:[SHOW Hi]:[SHOW terms] [SHOW ct] SAVE_STATE] lt;/td gt;
}]
[SET showNext [expr ($nexthigh + 1) - $nextlow]]
[IF {$showNext gt; $numDisplay} {[SET showNext $numDisplay]}]
[IF {$showNext lt;= $nexthigh amp; amp; $showNext != 0 amp; amp; $showNext gt; 0} {
lt;td class= #39;searchpagenos #39; gt;[IF {$showNext != 1} {
[CURL $_Path [SHOW nextlow]:[SHOW nexthigh] Next [SHOW showNext] results SAVE_STATE]
} ELSE {
[CURL $_Path [SHOW nextlow]:[SHOW nexthigh] Last result (only one left) SAVE_STATE]
}]
lt;/td gt;
}]
lt;/tr gt;
lt;/table gt;
}]
} ELSE {
lt;br gt;There were no results returned for #39;[SHOW search] #39;
}]
}]
}]
lt;/td gt;
lt;/table gt;
}
Elapsed Execution Time: 0.031 seconds
Template Variables:
| variable |
value | | ID | |sticker|ybnlive | | TABLE | | | par |
sticker | | theParms |
{} sticker ybnlive | | schema |
ybnlive | | cmd |
| | _TEMPLATE_LOOKUP |
1 | | width |
|
Tcl Stack Trace:
DEFAULT_ROW: Unable to find row in table #39;proto_clients #39; matching condition: #39;schemaname = #39;ybnlive #39; and sitetype != #39;A #39; #39;
while executing
quot;system_error quot;$msg quot; quot;
(procedure quot;error quot; line 55)
invoked from within
quot;error quot;DEFAULT_ROW: Unable to find $errRec in table #39;$tbl #39; matching condition: #39;$whereClause #39; quot; quot;
(procedure quot;DEFAULT_ROW quot; line 52)
invoked from within
quot;DEFAULT_ROW proto_clients quot;url quot; quot;schemaname = #39;[SHOW schema] #39; and sitetype != #39;A #39; quot; quot;
invoked from within
quot;IF {[SHOW nav] != quot;nav quot;} {
[DEFAULT_ROW proto_clients quot;url quot; quot;schemaname = #39;[SHOW schema] #39; and sitetype != #39;A #39; quot;]
[SET server [FIELD url]]
[IF... quot;
invoked from within
quot;EVAL $body quot;
(procedure quot;FORM quot; line 9)
invoked from within
quot;FORM quot;method=post action=[CURL $_Path 1:10] quot; {
lt;font size= quot;1 quot; gt;Search Terms : lt;/font gt; lt;br gt;
[IF {[SHOW search] == quot; quot;} {
[TEXT FIELD search SIZE ... quot;
invoked from within
quot;SET bodytext {
lt;table name=paddPage border=0 cellpadding=0 cellspacing=0 width= quot;[SHOW width] quot; gt;
lt;td width= quot;[SHOW width] quot; gt;
[FORM quot;method=post acti... quot;
|