Tuesday, February 26, 2008

Searching Struturo

There is a specific search form and view for results built into Struturo. This allows you to easily add a search block to a column and get formatted results when doing searches.

Create a block

The easiest way to get started is to create an HTML block. This block will submit 2 fields to the backend form: "Category" and "Query". If you don't want to search by Category, just leave the category input field value equal to null or don't include it in the form submit. "Query" will be the field the user is filling in.

In this example, the category field is "Press Release" always so it is hidden (type=hidden) from the HTML.

Search Block Definition

Here's the code if you need to copy

You could use a submit button instead of the arrow graphic in your implementation. And don't pass a category value unless relevant in your search.

<form method="post" action="Search?CreateDocument" name="Search">
<input name="Query" value="" />
<input name="Category" value="News Release" type="hidden" />
<a href="" onclick="document.Search.submit();return false;">
<img src="Files/button_arrow_14x18.jpg/$file/button_arrow_14x18.jpg" 
alt="search" width="14" height="18" border="0" />

Style the block accordingly

We have this as a blue background with an arrow for the submit. If we had it to do again, would probably just do a standard form submit with the validation added later to the page using JavaScript. Don't typically recommend this approach in case someone has JavaScript disabled.

Search Block on Web

HTML Output is just a table

So you can style it the way you like in your theme document. Note the thead and tbody are in there in case you want to use JavaScript to make the search results sortable.

Search HTML Output

End result can be very pretty

In this case, we actually added hover and click features using JQuery but you could style this table any way you need.

Search Results

Make sure to create a Section titled "Search Results"

The output view is going to show as the section called "Search Results" so make sure you have a section with the correct columns and tabs to make sure the results look like they are on a decent looking page.

Standard Domino Search

The end result of submitting the page is just a typical search view format so you can just search the view called "SearchPages" so whatever means you need to get to that URL is fine. Note in this example that the result has been URLencoded so you see %20 for space, etc.


struturo box

Live Online Demo Free

We are happy to give you and your team a live demo. Submit a request and we will coordinate a time that works best for you.