Customize Search in Laserfiche WebLink
Laserfiche Solution Contributed By: Susan Lesovsky, Applications Support Manager, Colorado Water Conservation Board
Laserfiche WebLink provides excellent out-of-the-box search capability that can be customized to fit your particular business needs. Here are some search customizations that we have implemented at the Colorado Department of Natural Resources (CDNR).
How to build custom searches and plug them into your Website
In order to prevent users from becoming overwhelmed with the multitude of different search options available, we created custom searches based on Website content and our existing Laserfiche templates.
To streamline access and eliminate user confusion, each custom search focuses on a particular program area or topic and uses a limited set of search criteria within the associated template. In addition, we wanted to have the search results appear in a new browser window.
Here is how we created all of our custom search components through the WebLink Designer and embedded them into our Website:
1. Open WebLink Designer and connect to the appropriate virtual directory. Navigate to the Welcome Page tab and then the Search Forms tab and click Add Search Form (you may be prompted to log in).

2. Enter a Search Name and Description. The Description field can be filled with a short description or left blank.

3. Select the type of form element you want to add:
- Text: Adds a text label to the search form.
- Input: Adds a text box to the search form. When a user submits the search form, WebLink will perform the appropriate Laserfiche search using the values specified in this text field. The Input field can be configured to a specific field or type.
- Line Break: Creates a section break.
- Submit: Adds a submit button to the form. This item is a mandatory element in a search form as this is how users start the search.
- Reset: Adds a reset button to the form. Clicking this button will clear the form of any specified values. If an input box is configured with a default value, the Reset button will clear that field of its current value and fill in the default value.
- Table: Inserts a table in the search form. You can drag other elements in the form into the cells of the table.
- Sort Selector: Adds a drop-down list containing available options for sorting the search results.
4. Drag items from the Toolbox pane onto the blank workspace to create items in the form. Move the items around the workspace until you are satisfied with how the form looks.
5. Configure the properties for each label or input field in the Properties Pane.
- Input fields can be linked to search types, specific fields or custom variables. This example shows linking to a specific list field. The list can be single or multi-select and it can be defined to either display all default values or only some of them. In this example, the confidential document types have been removed from the list.

- Input fields can also be configured to show a calendar dialog for dates and date ranges.

6. Text fields will render as labels and can be linked to a field with the Label For drop-down. Set up the input fields first so that you can link the label fields to them later.

7. Further configuration can be performed in the tabs below the workspace, specifically constraints in the Search Query tab.
- In order for search results to be returned properly, drop-down fields may need special handling. In this example, the document type field must NOT be set to <blank>.

- You can configure text fields to allow users to search by part of a word using wildcards.

8. The other tabs provide advanced options, but have not been used in this example. Here is a brief overview of their functions:
- The Sort Options tab allows you to define the items in a Sort Selector element.
- The Summary tab allows you to create a text description of the search results using tokens.
- The Code View tab provides a read-only view of the XML source code automatically generated by the Search Form Designer that represents the custom search form.
- The Search Form Designer performs basic validation on your custom search form.
- The Errors tab lists potential errors and warnings in your custom search form.
9. Once satisfied with the layout and properties configuration, click Save. Click the View the search form in WebLink link to view and test your new custom search form. Once you’ve made the necessary modifications, click Close to close the Search Form Designer.
10. Visit the welcome page for your WebLink instance. A link representing the custom search will have been added to the page.

11. We customized the CustomSearch.aspx page to eliminate many of the visual components and limit the view to the search alone. This is accomplished by adding “Min” to the URL:
http://cwcbweblink.state.co.us/WebLink/CustomSearchMin.aspx?SearchName=BoardMeetingsSearch&dbid=0

Here is sample code for configuring the CustomSearch.aspx page (saved as CustomSearchMin.aspx):
<body class="PageBackground <%= m_strings.GetString("STR_DIR_ATTRIBUTE") %>" dir="<%= m_strings.GetString("STR_DIR_ATTRIBUTE") %>" style="background-color: #FFFFFF;">
<form id="form2" runat="server" target="_new">
<table style="margin-top: 10px;" cellpadding="10" cellspacing="0">
<tr>
<td valign="top">
<div class="CustomSearchSection">
<weblink:CustomSearch runat="server" ID="CustomSearch" />
</div>
<div id="SearchResultsDiv" class="SearchResultsContent" style="margin-top: 40px;" runat="server">
<weblink:searchresultsbrowser
SortableColumns="COLUMN_TYPE_LASTDATE, COLUMN_TYPE_CREATEDATE"
AdditionalProperties="COLUMN_TYPE_CREATEDATE, COLUMN_TYPE_LASTDATE, COLUMN_TYPE_NUMPAGES, COLUMN_TYPE_TAGS"
ThumbnailCount=5
id="SearchResults" runat="server" width="100%" MaxLength="20" Visible="false"></weblink:searchresultsbrowser>
</div>
</td>
</tr>
</table>
</form>
</body>
Note: If you do not want the search results to open in a new browser window, take out the target=”_new” from this line of code: <form id=”form2″ runat=”server” target=”_new”> in the example above.
12. The URL is now ready to be plugged into the Website. The CDNR uses Microsoft Office SharePoint Server (MOSS) for its external Websites, which offers the use of Web parts to enhance Web page design and layout. A Page Viewer Web part was configured and used to display the custom WebLink searches. IFrames would also render the same results.

