Question
Is there any HOWTO or other beginner's documentation for SEARCH patterns when used for a formatted search in forms?
The examples I have seen so far usually included specific HTML tags - for example:
in
http://twiki.org/cgi-bin/view/Codev/PatchAdjustmentRequired
there is a
(<br><\/td>|value\=)"
part etc.
This makes me believe that to be able to write such a SEARCH expression you have to have a deeper knowledge about the HTML code that will be generated by TWiki when parsing the form.
I can get a few things to work after studying the HTML source of the generated pages - but I can't believe that this is the correct way, as I have no guarantee that the HTML code will always be exactly like this - just updating to the next version of TWiki might break this.
What am I missing?
Another example:
http://twiki.org/cgi-bin/view/Codev/NeedsARethink
uses this code:
%SEARCH{ "META.FORM.*name\=\"ChangeProposalForm\";[C]urrentState.*value\=\"%TOPIC%\"" web="Codev" excludetopic="BugReportTopicTemplate" casesensitive="on" regex="on" nototal="on" nosearch="on" order="modified" reverse="on" format="| <a href=$quot%SCRIPTURL%/view%SCRIPTSUFFIX%/$web/$topic#foo_$rev$quot title=$quot$formfield(TopicSummary)$quot>$web.$topic</a> | [[$formfield(TopicClassification)]] | $formfield(OutstandingIssues) | $percntCALC{$quot$EVAL($LISTSIZE($T(R$ROW(0):C$COLUMN(-1)))-$EXACT($T(R$ROW(0):C$COLUMN(-1)),))$quot}$percnt | $formfield(HasPriority) |$n" separator=" "}% \
| Total: %CALC{"$ROW(-2)"}% Proposals | | | %CALC{"$SUM($ABOVE())"}%
I have to admit that I cannot parse this. How can I learn (1) to read this, and (2)
to compose similar SEARCH patterns myself?
[Actually I'm trying to understand how your "patch database" is implemented and if we
can do something similar. My main concern is that I don't know how this scales if you
have to deal with
many patches. At the moment I fail setting up a simple demo system
because the SEARCH patters are beyond my grasp.]
Thanks in advance.
Environment
--
WolfgangDenk - 17 Feb 2005
Answer
How-to docs in this area needs to be improved.
You can ignore the
(<br><\/td>|value\=) since this is a special case to search for topics that have forms in the old
TWikiCategoryTable format (with HTML tags, long gone) and new
TWikiForms format (with
value=).
You basically should search for the raw meta data of forms, as shown when you add a
?raw=debug to the view URL (
https://twiki.org/cgi-bin/view/Support/DocsForSearchPatternsWithForms?raw=debug)
Dissecting
"META.FORM.*name\=\"ChangeProposalForm\";[C]urrentState.*value\=\"DocsForSearchPatternsWithForms\"", which is a
RegularExpression search:
- There are two ANDed searches separated by semicolon (TWiki specific, not regex)
- First part makes sure that only forms of name
ChangeProposalForm are considered
- Second part filters to get only those forms that have a
CurrentState of NeedsARethink (expanded from %TOPIC%)
- The backslash in
\" is required to escape the quotes
- Other characters are regex specific
- On
[C]urrentState, the C in parenthesis is almost identical to a simple CurrentState search, except that it does not find the current topic where the search is. In other words, it is a trick to prevent the search topic itself from showing up in the search result.
--
PeterThoeny - 21 Feb 2005