create new tag
, view all tags


I have not been able to get searching to work, when looking for form field values. Regardless of what I try the searches always come back empty.

I've read the HowToSearchFormFields, SearchPatternCookbook, FormattedSearch, and VarSEARCH topics, and many others. None of the example syntaxes seem to work.

We are using CVS as the backing store for TWiki (in case it matters).

Here are my latest attempts, but return nothing:

%SEARCH{"[T]echLead.*value=.*[J]ohnNorvell" regex="on" type="regex" scope="text" format="| [[$topic]] |"}%


%METASEARCH{type="formfield" name="TechLead" value="JohnNorvell"}%

Also, is it possible to search for multiple form field / values in a single statement? I haven't seen any examples to do that.


TWiki version: TWikiRelease04x00x05
TWiki plugins: IfDefinedPlugin FilterPlugin VersionLinkPlugin WebPermissionsPlugin RenderListPlugin WysiwygPlugin XpTrackerPlugin
Server OS: SunOS 5.8
Web server: Apache
Perl version:  
Client OS: Windows XP SP2
Web Browser: Firefox
Categories: Forms, Search

-- JohnENorvell - 04 Mar 2008


ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

TWiki will search for meta data in topics in this format:
%META:FIELD{name="TechLead" attributes="" title="TechLead" value="JohnNorvell"}%

Check your topics if this data is stored.

-- ArthurClemens - 04 Mar 2008

The TWikiInstallation application is an example of a search on multiple form fields.

-- PeterThoeny - 05 Mar 2008

When I try:

it just echos back the command as if it couldn't parse it.

When I tried:

%SEARCH{ search="META:FIELD.*?TechLead.*?JohnNorvell" regex="on" nosearch="on" format="| [[$topic]] | $formfield(ProjectName) |" }%

it parsed, but returned no results.

How can I verify for sure that the metadata is stored properly? When I examine the topic page, the form table is visible at the end of the page with the variables and values. Is there a way to look at the "raw" table data as stored in Twiki (aside from looking at the HTML page source).

-- JohnENorvell - 05 Mar 2008

Just taking your search from above into the current topic:

%SEARCH{ search="META:FIELD.*?TechLead.*?JohnNorvell" regex="on" nosearch="on" format="| [[$topic]] | $formfield(ProjectName) |" }%

Number of topics: 1

There you are - the current topic is found. So, in theory and on twiki.org, it seems to work. Maybe it is indeed your backend store which confuses TWiki? Do "normal" searches outside form fields work as expected?

Or is it your grep package? TWiki's search is based on a naive grep, GNU grep in particular, and there have on occasion been configuration problems with that, in particular on Solaris which has a GNU-incompatible grep. If I recall correctly, installing GNU grep and adjusting the paths in /bin/configure is the recommended solution for that.

And, BTW: You can look at the raw data including meta data by using the raw=debug parameter, as in:

-- HaraldJoerg - 05 Mar 2008

Simple searches do work, but if I use the Advanced Search form and enter the META search above it doesn't return anything. I used the raw = debug and verified that the formfields are stored with the topic pages, so that doesn't seem to be the problem.

I will look into the GNU grep and see if that makes any difference.

-- JohnENorvell - 05 Mar 2008

Closing this question after more than 30 days of inactivity. Feel free to re-open if needed.

-- PeterThoeny - 01 May 2008

I had the same problem - it turned out that in configuring paths to grep, I had eliminated the parameters ( %CS{|-i}% %DET{|-l}% -H -- %TOKEN|U% %FILES|F%). Adding these back using the configure script fixed the search problem. -- FG

-- TWikiGuest - 07 Jun 2008

Your code is your above in question is very close to what you need....just a couple of mistakes...first of all in METASEARCH the type should be type="field" NOT "formfield" other than that, assuming you have your values correct, that code should work. Secondly, on the SEARCH line, [T]echLead.*value=.*[J]ohnNorvell should be [T]echLead.*value\=.*JohnNorvell....added those changes will make the code work. Doing a double form field search is easy...just separate form fields by a ";" example: "[T]echLead.*value=.*[J]ohnNorvell;[F]ormfieldname.*value=.*[J]aneDoe"

-- NatalieBrown - 2011-10-06

Change status to:

Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r10 - 2011-10-06 - NatalieBrown
  • 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-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.