This question about Topic Markup Language and applications: Answered

How Do I Search Headings Only?

I want to do a %SEARCH% that looks for topics which have the search term in a heading. Ideally any level of heading, but could be restricted to levels 1-3. I am assuming this is possible using Regular Expressions. Could anyone tell me how to do this?

This is my starting point as a form which searches the topics names. I want to adapt it to search the headings.

<form name="search"  action="%SCRIPTURLPATH{view}%/%WEB%/%TOPIC%"> <input type="text" name="search"> <input id="submit" type="submit" tabindex="13" value='%MAKETEXT{"Search"}%' /> </form>

%SEARCH{"%URLPARAM{"search" default =""}%" scope="topic"}%



Hello. You could start looking this example here and modify it to your needs.

-- EnriqueCadalso - 23 Nov 2011

Try this example

Here is another example to try: it will match any heading, with the entered string.
<form name="search"  action="%SCRIPTURLPATH{view}%/%WEB%/%TOPIC%"> <input type="text" name="search" value="%URLPARAM{"search" }%"> <input id="submit" type="submit" tabindex="13" value='%MAKETEXT{"Search"}%' /> </form>

%SEARCH{"^---\++\ .*%URLPARAM{"search" default =""}%" type="regex"}%

Searched: ^---\++\ .*example

Results from Support web retrieved at 11:49 (GMT)

Problem The WebTopicList (linked to as Index in the side bar) lists all the topics as bullets, which is not very elegant. Using the Extensions.FilterPlugin we can...
Extra Detail: Better Indent Features Are Needed Main.JohnHenning 01 May 2013 Easy to use indenting Importance for moderately complex pages I should like to ...
Some examples of the FORMAT macro where you might have used Extensions.ForEachPlugin can also be found at Faq40 View this topic on trunk to see rendered outpu...
This topic is designed to be a generic 'helper', reusable for any DataForm you may have, which makes a UI to create and summarise topics using a given DataForm. %...
* Yes * Some special macros are always expanded. See template topic macro expansion. * Refer to System.TemplateTopics and STARTSECTION with the type="expand...
Glossary Term Definition Abaxial the leaf surfaced turned away from the stem of the plant Adventitious roots, Adventitious root 'roots arising from...
This is mainly for users who are installing Foswiki in a non root environment and want to use their own Perl installation in addition to installing CPAN modules. ...
Integrate generated content It is trivial to use Foswiki with topics stored as text files and it is straightforward to produce text files to be used as Foswiki to...
Issue The TABLE variable uses tablerules to enable/disable a column separator line. I had expected the tablebordercolor option to control the color of the rules a...
Issue I have some JavaScript / CSS code that is designed to change the background color of a table cell ( td ) based on the text content of the cel. This code wo...
How to add TOC in foswiki like TOC in wikipage with border and hide/show options. Is it possible in foswike such kind of display table of contents? Main.Deepthi...
Discussion Is there a way to construct DBQUERY search arguments dynamically so that a query could be refined? I used to do this with the FormQueryPlugin, which co...
Answer You can do this with CSS and the Extensions.TablePlugin. The IfStatement checks the url parameter cover. If it is set to print (this is how the print view ...
The documentation describes how to change the layout for viewing: System.PatternSkinCustomization#I_want_to_place_the_form_at_the although I have given a cl...
Example: Item 1 Item 2 Item 1 Item 2 Item 3 Is rendered (wrong): Item 1 Item 2 Item 1 Item 2 Item 3 Correct rendering: Item 1 Item 2 Item 1 Item 2 ...
I want to do a %SEARCH% that looks for topics which have the search term in a heading. Ideally any level of heading, but could be restricted to levels 1 3. I am a...
Foswiki versions 1.0.5 is protected against the most basic CSRF attacks where simple HTML tags can alter content. Foswiki versions 1.0.6 and later contain a major...
Shorter URL Cookbook Different methods to hide bin and view etc. in the website URLs. How to enable shorter URLs in Foswiki This supplemental document describes...
Number of topics: 18

Wow. That's brilliant. Thanks so much. I had already looked at the example in SearchPatternCookbook but was unable to adapt it to my needs. I've been trying to learn Regular Expressions but I'm finding them hard to get the hang of.

-- TamsinTweddell - 28 Nov 2011

QuestionForm edit

Subject Topic Markup Language and applications
Version Foswiki 1.1.3
Status Answered
Related Topics
Topic revision: r4 - 28 Nov 2011, TamsinTweddell - This page was cached on 09 Jan 2018 - 12:49.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License