Tags:
create new tag
view all tags

Why does WebSearch contain a search query?

WebSearch contains a line with %SEARCH%. In the Codev web this results in 1 search result, in other webs in the feedback "Number of topics: 0" - while haven't made a search at all!

Can anyone shed a light on this? Otherwise I will just remove the line.

-- ArthurClemens - 01 Apr 2005

I've removed the line.

-- ArthurClemens - 04 Apr 2005

Oops, TWiki.org's search is broken by removing the SEARCH.

TWiki.WebSearch has an embedded search so that you can run a search and see the result in the same page. That way it is easy to refine the search (like in Google).

Agreed that the zero hit display is confusing when you arrive at the topic in the first place.

I restored the SEARCH and added some SpreadSheetPlugin magic to suppress search in case the search URL parameter is empty.

-- PeterThoeny - 05 Apr 2005

Would that mean that search is broken if SpreadSheetPlugin is disabled?

-- ArthurClemens - 05 Apr 2005

Correct, search would be broken if SpreadSheetPlugin is disabled. In fact, the form of TWikiRelease01Sep2004 already has CALC to initialize the radio buttons and checkbox, e.g. <input type="radio" class="twikiRadioButton" id="topictitle" name="scope" value="topic" %nop>CALC{$IF($EXACT(,topic),checked="checked")}% />

I got a report that WebSearch is still broken. The change I did yesterday with the conditional SEARCH did not resolve the %SCRIPTURLPATH% and %SCRIPTSUFFIX% in the links, resulting in links like http://twiki.org/cgi-bin/view/TWiki/%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/TWiki/TextFormattingRules

For now I had to revert search to how it was 2 days ago. We could leave it that way.

Or we could fix it if the zero hit display is disturbing when arriving on the search page. One possible way is to enhance SEARCH to disable any output if the search string is empty. Disabling output if the search string is empty needs to be done with an additional SEARCH parameter, or we risk to break existing TWikiApplications out there. This could be a new disableempty="on" switch.

-- PeterThoeny - 05 Apr 2005

Peter, can you tell me what was broken by removing the line?

-- ArthurClemens - 05 Apr 2005

Hitting submit did nothing, e.g. you just end up at the same page without any action (no search result).

Note that in the old days the form action pointed to the search script. For CairoRelease we changed that to point to the view script, e.g. to view the same page, showing the search string, the result, and a button to refine the search.

Note that the same change should be done to the WebSearchAdvanced page (pending)

-- PeterThoeny - 08 Apr 2005

I am for a disableempty="on" or hidezeroresults="on" parameter.

-- ArthurClemens - 08 Apr 2005

To be in line with the other SEARCH parameter I have adopted the name nozeroresults. The attached patch is diffed to Search.pm SVN 4128.

Question: should UI/Search.pm be updated as well?

Documentation to be added to TWikiSearch, below nototal:

Parameter: Description: Default:
nozeroresults="on" Suppress search result if no hits Show "Number of topics: 0"

-- ArthurClemens - 26 Apr 2005

This is now in SVN 4269.

On ntwiki I've added TWiki.TWikiSearch (with updated documentation, see above), and updated TWiki.WebSearch with the new parameter.

-- ArthurClemens - 04 May 2005

Note that this patch does not resolve the situation that no results have been found after a search, vs. the situation on WebSearch when no search has been entered.

Creative solution needed.

In any case show nothing if the url does not contain ?query ?

-- ArthurClemens - 01 Sep 2005

put %URLPARAM{"search" default="on"}% as the argument to nozeroresults? but that wouldn't work if the search was for 'on'.

-- SamHasler - 03 Sep 2005

The problem is that nozeroresults may be any string, as long as it is not false, no or 0; all other cases will be evaulates as true. nozeroresults="bla" means that nozeroresults=0, so using URLPARAM will set nozeroresults to false even if there is an empty string.

So actually nozeroresults should be zeroresults, defaulting to on.

Line 385 in Search.pm should be something like this:

    my $zeroResults =   1 - TWiki::isTrue( ($params{zeroresults} || 'on'), $nonoise );

Then the SEARCH parameter may become:

[...] zeroresults="off%URLPARAM{search}%"

-- ArthurClemens - 03 Sep 2005

I have made the reversal in SVN 6253. Have a look at the results in http://develop.twiki.org/~develop/cgi-bin/view/Main/WebSearchAdvanced.

New SEARCH syntax:

Parameter: Description: Default:
zeroresults="off" Suppress all output if there are no hits zeroresults="on", displays: "Number of topics: 0"

-- ArthurClemens - 04 Sep 2005

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatdiff nozeroresults.diff r1 manage 0.9 K 2005-04-26 - 19:32 UnknownUser Adds support for nozeroresults parameter to SEARCH query
Edit | Attach | Watch | Print version | History: r16 < r15 < r14 < r13 < r12 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r16 - 2005-09-04 - ArthurClemens
 
  • 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.