Tags:
create new tag
view all tags

Question

This must fall in the category of something-I'm-doing-that-I-just-don't-see.

First off, SEARCH inherently works fine; the WebSearch and WebSearchAdvanced topics display the 'Number of topics' after the results.

I created a specialized search page that has both a simple search and an advanced search on it. I copied the simple search from WebSearch and the advanced search from WebSearchAdvanced, then made changes: I removed a few options, changed some others, modified some of the explanatory text, and limited the search scope to a subset of topics in one web.

The problem I've encountered with this special search topic is that I cannot get the 'Number of topics' line to display, either when the number is zero or non-zero. I've tried all four combinations of nototal and zeroresults values, but none of them causes the number of topics to display.

I'm hoping someone can spot what's wrong (or point me to documentation I somehow missed that explains this behavior). Let me know if you need more information.

Here is what produces my simple search.

<form action="%SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%">
Find Topics: 
<input type="text" name="q" size="70" value="%URLPARAM{"q"}%" />&nbsp;<input type="submit" class="twikiSubmit" value="Search" />
</form>

%SEARCH{ 
"%URLPARAM{"q"}%" 
web="PCM" 
topic="ChReq*" 
type="keyword" 
scope="all" 
expandvariables="on" 
nosearch="off"
nosummary="on" 
nototal="off" 
zeroresults="on" 
header="| *CR name:* | *Last Changed By:* | *Last Changed On:* | *Created By:* | *Created On:* |" 
format="| [[$topic]] | $wikiusername| $date | $createwikiusername | $createdate |" }%

Environment

TWiki version: TWikiRelease04x01x01
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin, SpreadSheetPlugin,Plugins.CommentPlugin,Plugins.CompareRevisionsAddonPlugin,Plugins.DateFieldPlugin,Plugins.EditTablePlugin,Plugins.GluePlugin,Plugins.PreferencesPlugin,Plugins.RenderListPlugin,Plugins.SlideShowPlugin,Plugins.SmiliesPlugin,Plugins.TablePlugin,Plugins.TwistyPlugin,Plugins.WorkflowPlugin,Plugins.WysiwygPlugin
Server OS: Solaris 10
Web server: Apache 1.3.33
Perl version: 5.8.4
Client OS: Windows XP
Web Browser: Firefox 1.5.0.11
Categories: Search

-- JohnWorsley - 22 Mar 2007

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

I am still looking for help with this issue; please let me know if there is any additional information I can provide. Thank you!

-- JohnWorsley - 26 Apr 2007

This looks like a plain bug in TWiki.

As a quick shot, try the following one-line replacement in templates/searchformat.pattern.tmpl:

-%TMPL:DEF{"content"}%%SPLIT%Search: <b> %SEARCHSTRING% </b><p />
+%TMPL:DEF{"content"}%%SPLIT%%TMPL:P{"searched"}%<p />

If this makes things work as you expect, drop a note (and mark this question as answered) - I'll open a bug item for that. Or you could open the bug yourself.

-- HaraldJoerg - 26 Apr 2007

A bug entry exists: Bugs:Item3949.

-- ArthurClemens - 26 Apr 2007

I made the change Harald suggested, and my search behavior has not changed. When I look at the DEF for "searched", I see a tag for the number of results, but no actual text to display "Number of topics:" - where is that supposed to be coming from?

%TMPL:DEF{"searched"}%<span class="patternSearched">%MAKETEXT{"Searched:"}% <b><noautolink>%SEARCHSTRING%</noautolink></b></span><span id="twikiNumberOfResultsContainer"></span><span id="twikiModifySearchContainer"></span>%TMPL:END%

-- JohnWorsley - 27 Apr 2007

In recent Pattern skins, the "Number of topics" is created dynamically with Javascript, see %TMPL:DEF{"count"}% in templates/searchbase.pattern.tmpl. The contents of this template ought to be inserted in the originally empty <span id="twikiNumberOfResultsContainer"></span> element. I can only guess that the reason for this is that it was the easiest method to get the number of hits before the results table. Unfortunately TWiki templates are a mystery to me, and Pattern doubly so, so I have no idea why the fix which works for me fails for you frown

-- HaraldJoerg - 27 Apr 2007

I imagine the answer is, because I'm using QuickMenuSkin. I'll have to dig in that.

-- JohnWorsley - 28 Apr 2007

Closing this after more than 30 days inactivity; re-open if needed...

-- PeterThoeny - 02 Jun 2007

The problem has to be with QuickMenuSkin, because when I rename search.quickmenu.tmpl and searchformat.quickmenu.tmpl so that the secondary skin (pattern) is used, I get the number of topics as expected.

I will pursue this with the skin developer.

-- JohnWorsley - 19 Jun 2007

I use the quickmenu skin as well (heavily editted) and had the same problem. I've updated the quickmenu skin search template file $TWIKI/templates/search.quickmenu.tmpl to add the following (as my searchformat.quickmenu.tmpl includes the search file but didn't define the "count" statement);

%TMPL:DEF{"count"}%%MAKETEXT{"Number of topics:"}% <b>%NTOPICS%</b>
<script type="text/javascript">
// write results at the top
//<![CDATA[
var results;
if (!results) results = [];
results.push(%NTOPICS%);
var total=0;
for (var i=0; i<results.length; ++i) {
total += results[i];
}
var text = "<br />" + "%MAKETEXT{"Number of topics:"}%" + " <b>" + total + " <\/b>";
insertHtml(text, 'twikiNumberOfResultsContainer');
if (total < 10) {
insertHtml('', 'twikiBottomResultCount');
}
//]]>
</script>%TMPL:END%

-- SallyHoughton - 10 Oct 2008

Change status to:
Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r11 - 2008-10-10 - SallyHoughton
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.