none
authorPeterThoeny <PeterThoeny>
Fri, 17 May 2002 06:57:28 +0000 (06:57 +0000)
committerPeterThoeny <PeterThoeny>
Fri, 17 May 2002 06:57:28 +0000 (06:57 +0000)
TWiki/FormattedSearch.mdwn

index ce12ced..c66ec73 100644 (file)
@@ -2,7 +2,6 @@
   <ul>
     <li><a href="#TWiki Formatted Search Results"> TWiki Formatted Search Results</a><ul>
         <li><a href="#Syntax"> Syntax</a></li>
-        <li><a href="#Nested Search"> Nested Search</a></li>
         <li><a href="#Examples"> Examples</a><ul>
             <li><a href="#Bullet list showing topic name a"> Bullet list showing topic name and summary</a></li>
           </ul>
         </li>
       </ul>
     </li>
+    <li><a href="#TWiki Installation Error">TWiki Installation Error</a><ul>
+        <li>
+          <ul>
+            <li><a href="#Nested Search"> Nested Search</a></li>
+          </ul>
+        </li>
+      </ul>
+    </li>
     <li><a href="#TWiki Installation Error">TWiki Installation Error</a></li>
   </ul>
 </div>
@@ -77,11 +84,11 @@ Variables that can be used in the format string:
   </tr>
   <tr>
     <td><code>$date</code></td>
-    <td> Time stamp of last topic update, like <code>29 Jun 2010 - 15:35</code></td>
+    <td> Time stamp of last topic update, like <code>29 Jun 2010 - 15:36</code></td>
   </tr>
   <tr>
     <td><code>$isodate</code></td>
-    <td> Time stamp of last topic update, like <code>2010-06-29T15:35Z</code></td>
+    <td> Time stamp of last topic update, like <code>2010-06-29T15:36Z</code></td>
   </tr>
   <tr>
     <td><code>$rev</code></td>
@@ -143,37 +150,17 @@ Variables that can be used in the format string:
 
 **_Note:_** For `$pattern(reg-exp)`, specify a [[RegularExpression]] that scans from start to end and contains the text you want to keep in parenthesis, like `$pattern(.*?(from here.*?to here).*)`. You need to make sure that the integrity of a web page is not compromised; for example, if you include a table make sure to include everything including the table end tag.
 
-## <a name="Nested Search"></a> Nested Search
-
-Search can be nested. For example, search for some topics, then form a new search for each topic found in the first search. The idea is to build the nested search string using a formatted search in the first search.
-
-Here is an example. We want to search for topics, do a nested search with each hit, and show the result as nested bullets. Parameters like `scope="text" regex="on" nosearch="on" nototal="on"` are omitted for simplicity.
-
-- First search:
-  - `%SEARCH{ "freedom" format="   * $topic" }%`
-- Second search. For each hit we want this search:
-  - `%SEARCH{ "(topic of first search)" format="      * $topic" }%`
-- Now we nest the searches. We need to escape the second search, e.g. the first search will build a valid second search string:
-  - `%SEARCH{ "freedom" format="   * $topic: $n$percntSEARCH{ \"$topic\" format=\"      * $dollartopic" }$nop%\" }%`
-
-Note that we escape the second search so that it does not get evaluated by the first search:
-
-- `$percnt` to escape the leading percent of the second search
-- `\"` to escape the qouble quotes
-- `$dollar` to escape the `$` of `$topic`
-- `$nop` to escape the `}%` sequence
-
 ## <a name="Examples"></a> Examples
 
 <a name="SearchBulletList"></a>
 
 ### <a name="Bullet list showing topic name a"></a> Bullet list showing topic name and summary
 
-Write this:
+**Write this:**
 
 `%SEARCH{ "FAQ" scope="topic" nosearch="on" nototal="on" header="   * *Topic: Summary:*" format="   * [[$topic]]: $summary" }%`
 
-To get this:
+**To get this:**
 
 # <a name="TWiki Installation Error"></a> TWiki Installation Error
 
@@ -181,11 +168,11 @@ Incorrect format of searchformat template (missing sections? There should be 4 %
 
 ### <a name="Table showing form field values"></a><a name="Table showing form field values "></a> Table showing form field values of topics with a form
 
-Write this in the Know web:
+**Write this in the Know web:**
 
 `| *Topic:* | *OperatingSystem:* | *OsVersion:* |`<br />`%SEARCH{ "[T]opicClassification.*?value=\"[P]ublicFAQ\"" scope="text" regex="on" nosearch="on" nototal="on" format="| [[$topic]] | $formfield(OperatingSystem) | $formfield(OsVersion) |" }%`
 
-To get this:
+**To get this:**
 
 <table border="1" cellpadding="1" cellspacing="0">
   <tr>
@@ -207,11 +194,37 @@ To get this:
 
 ### <a name="Extract some text from a topic u"></a> Extract some text from a topic using regular expression
 
-Write this:
+**Write this:**
 
 `%SEARCH{ "__Back to\:__ TWikiFAQ" scope="text" regex="on" nosearch="on" nototal="on" header="TWiki FAQs:" format="   * $pattern(.*?FAQ\:[\n\r]*([^\n\r]+).*) [[$topic][Answer...]]" }%`
 
-To get this:
+**To get this:**
+
+# <a name="TWiki Installation Error"></a> TWiki Installation Error
+
+Incorrect format of searchformat template (missing sections? There should be 4 %SPLIT% tags)
+
+### <a name="Nested Search"></a> Nested Search
+
+Search can be nested. For example, search for some topics, then form a new search for each topic found in the first search. The idea is to build the nested search string using a formatted search in the first search.
+
+Here is an example. Let's search for all topics that contain the word "culture" (first search), and let's find out where each topic found is linked from (second search).
+
+- First search:
+  - `%SEARCH{ "culture" format="   * $topic is referenced by: (list all references)" nosearch="on" nototal="on" }%`
+- Second search. For each hit we want this search:
+  - `%SEARCH{ "(topic found in first search)" format="   $topic" nosearch="on" nototal="on" }%`
+- Now let's nest the two. We need to escape the second search, e.g. the first search will build a valid second search string. Note that we escape the second search so that it does not get evaluated prematurely by the first search:
+  - Use `$percnt` to escape the leading percent of the second search
+  - Use `\"` to escape the double quotes
+  - Use `$dollar` to escape the `$` of `$topic`
+  - Use `$nop` to escape the `}%` sequence
+
+**Write this:**
+
+`%SEARCH{ "culture" format="   * $topic is referenced by:$n      * $percntSEARCH{ \"$topic\" format=\"   $dollartopic\" nosearch=\"on\" nototal=\"on\" }$nop%" nosearch="on" nototal="on" }%`
+
+**To get this:**
 
 # <a name="TWiki Installation Error"></a> TWiki Installation Error