Calling findinsite-ms
GREAT! You are now ready to link to findinsite-ms from your web site.
Search page link
Your first option is simply to provide a link direct to findinsite-ms.
If you are using a hosted search or test site, then you will need to use an absolute URL.
As described in the findinsite-ms Installation Guide,
the actual URL you must use to display the findinsite-ms search page will vary.
Here is a possible URL:
When you provide this link, you might call it
Advanced search.
Search box form
It is straightforward to add a search box to a web page...
but see the charsets information below.
In most cases, the following HTML will work:
<form method='get' action='/findinsite/search.aspx'>
Search for: <input name="Text" type='text' size='20' maxlength='80' />
<input type="submit" value="Search" />
</form>
You might need to change the URL used for the FORM ACTION attribute value.
If you want your search box to take up a small amount of space, try this HTML:
<form method='get' action='/findinsite/search.aspx' style='display:inline;'>
Search for: <input name='Text' type='text' size='20' maxlength='80' />
<input type="submit" value="Search" />
</form>
Search box in ASPX
ASPX pages typically already have a FORM on the page, so a search box form may not be suitable.
However the above search box form will work as long as it is outside the main form (which has runat="server" ).
When you want to have a search box and button in the middle of an ASPX page form, use the script and HTML like the following.
(You may need to append charset information to the search string - see below, eg append &cs=ISO-8859-1 to the search redirect string.)
<script Language="c#" runat=server>
public void btnSearch_Click(object sender, System.EventArgs e)
{
string search = Server.UrlEncode(TextString.Text);
Response.Redirect("/findinsite/search.aspx?Text=" + search);
}
</script>
<asp:textbox id="TextString" runat="server"></asp:textbox>
<asp:Button ID="btnSearch" Runat="server" Text="Search"
OnClick="btnSearch_Click"/>
Search box Character Set
If you use a search box, then you need to think about the character set (charset)
of the page the box is in.
If the page is in character set "UTF-8" then the above code will be OK.
However if the page is in a different charset, then the browser will return
any characters using that charset. Unless you tell findinsite-ms otherwise,
findinsite-ms will interpret these characters as "UTF-8" and therefore might
search for the wrong text. To fix this, tell findinsite-ms the charset of the page using
the cs runtime parameter.
For example, if the page is in the Japanese "shift_jis" charset, then set
cs by adding this code into your form:
<input name='cs' type='hidden' value="shift_jis" />
The findinsite-ms localised search pages always use the "UTF-8" charset which is able to represent
all possible characters, while being recognised by virtually all recent browsers.
Subset searches
If findinsite-ms is searching more than one search database, you can provide the user with a check box
list of available subsets.
See the Subsets page for details of how to set this up.
Dynamic database searching
Alternatively, you can tell findinsite-ms which search database(s) to search
on a per-request basis - see the
dynamic database searching information for details.
|