Building a standard XHTML compliant Domino search
As you probably know, it is possible to customise both the Domino search and the search results. But there is no easy way to return that search result into XHTML compliant code: the $$SearchTemplate is used in edit mode, and the results are rendered with HTML 4 tags. Here is the solution I found. It requires:
- A search form in XHTML by hand
- A Notes search form to convert the fields to Query_String values
- A Notes navigator with a $$NavigatorTemplate
- A QueryOpen agent for the navigator which does the search and renders it in a field on the template
The HTML search form
This form is made by hand in XHTML and posts the search text to create a document with the 'search' form. You can put it on any XHTML page:
<form method="post" action="/domino/search!CreateDocument" name="_search">
<input name="Query" value="" />
<input class="button" type="submit" value="Search" />
</form>
The real but dummy Domino 'search' form
This Notes form will never be shown. It only redirects you to a page that does the real job. This pass-through real form is needed, because I had to have a real post request: Semantic HTML requires that everything has to work, even with JavaScript disabled.
On the form, a 'SaveOptions' field with value '0' stops any document from being created. Instead, the '$$Return' field opens the searchresults 'page' with the fields in the QueryString.
"["+DbPath+"searchresults?Open&view="+View+"&search="+@ReplaceSubstring(Query; " "; "+")+"]"
The only reason for this form is to convert the fields to a Query_String in order to pass it to a normal page:
/domino/searchresults?Open&view=archive&search=blog+template
The 'searchresults' navigator
What I was looking for: a method to execute a LotusScript agent to perform the full text search and still use a form in read mode to display the results. A dummy navigator with a matching $$NavigatorTemplate fits these needs perfectly. I could have posted the fields directly to a LotusScript agent, but then I would have had to redo all the template coding I did on my pages in LotusScript as well. It could be done, but why duplicate what you have already?
The 'searchresults' QueryOpen agent
This agent picks up the values from the Query_String, does the full text search and renders the result in the field 'SearchResults'. In fact, it renders also the title. Optionally, you can add another field 'SearchDebug' on the $$Navigatortemplate for debug info.
I will explain the searchresults QueryOpen agent in full detail in next post. For the time being, you can admire the XHTML search in the right pane on this page. Try it.
Comments
To add a comment, log in or register as new user. It's free and safe.