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"}%
 

Thanks

Tamsin


Hello. You could start looking this example here http://foswiki.org/System/SearchPatternCookbook#Pattern_8:_Extract_level_451_headings 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 10:24 (GMT)

BestPracticeTip3
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...
BetterIndentFeaturesNeededExtraDetail
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 ...
Faq39
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...
Faq56
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. %...
Faq58
* Yes * Some special macros are always expanded. See template topic macro expansion. * Refer to System.TemplateTopics and STARTSECTION with the type="expand...
Glossary
Glossary Term Definition Abaxial the leaf surfaced turned away from the stem of the plant Adventitious roots, Adventitious root 'roots arising from...
HowToUseFoswikiWithLocalPerlInstallation
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. ...
IntegrateGeneratedContent
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...
Question1173
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...
Question1174
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...
Question1230
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...
Question1581
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...
Question189
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 ...
Question1922
I have upgraded my Foswiki from 1.1.9 to 2.1.4, upgraded all of my extensions and plugins. So far, everything seems to run beautifully (except if there are still ...
Question1945
Hi, Problem description i tried to create a table and used the LISTEACH function to modify the cell content. In my first test all cells are empty and i was not a...
Question265
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...
Question617
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 ...
Question978
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...
SecurityAlert-CVE-2009-1434
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...
ShorterUrlCookbook
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: 20


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
Extension
Version Foswiki 1.1.3
Status Answered
Related Topics
Topic revision: r4 - 28 Nov 2011, TamsinTweddell
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy