Home > Fluid Dynamics Search Engine > Help > 1120

Advanced Search: Forcing additional search terms

In rare cases it is necessary to create a custom search form in which search terms are entered in multiple form fields. FDSE accepts search terms via the main "Terms" form field and also from optional form fields named "p:q1", "p:q2", "p:q3"... "p:qn". Internally, all search strings from the various fields are joined together, separated by spaces, and FDSE then applies its usual rules for finding matching pages. In practice you will want to force the Match=1 setting so that all terms will be required to match.

Example - Forced, Hidden Terms

Here is an example of how to create a search form which only finds results in a certain subfolder of your site, by forcing a required search term of "url:www.xav.com/scripts/search":

<form method="get" action="search.pl">
<input type="hidden" name="Match" value="1" />
<input type="hidden" name="p:q1" value="url:www.xav.com/scripts/search" />
Keywords: <input name="Terms" /> <input type="submit" />
</form>
Keywords:
( input "Keywords" required )

Example - Multiple Inputs

Here is an example of a search form which mixes a freeform search box with an enumerated list of search criteria:

<form method="get" action="search.pl">
<input type="hidden" name="Match" value="1" />
Title contains <select name="p:q1">
	<option value="title:foo">foo</option>
	<option value="title:bar">bar</option>
	<option value="title:xxx">xxx</option>
</select><br />
Keywords: <input name="Terms" /> <input type="submit" />
</form>
Title contains
Keywords:
( input "Keywords" required )

Limitations

Required field behavior

FDSE will only enter into "search mode" if the "Terms" variable is non-empty. When the "Terms" variable is empty, FDSE will display the search tips page, even if other "p:q1" and "p:q2" fields are present and contain search terms.

To override this behavior, create a hidden field named "Terms" and give it a fixed value " " (blank space). Then name your free-form text input as p:qn. Then, all form submissions will result in searching, even if the free-form text input is blank.

<form method="get" action="search.pl">
<input type="hidden" name="Match" value="1" />
<input type="hidden" name="Terms" value=" " />
Title contains <select name="p:q1">
	<option value="title:foo">foo</option>
	<option value="title:bar">bar</option>
	<option value="title:xxx">xxx</option>
</select><br />
Keywords: <input name="p:q2" /> <input type="submit" />
</form>
Title contains
Keywords:
( input "Keywords" NOT required )

History: the additional search terms functionality was added in FDSE version 2.0.0.0052.


    "Advanced Search: Forcing additional search terms"
    http://www.xav.com/scripts/search/help/1120.html