Customized Web Searching at Last!

This Content Component encountered an error
Ever wonder the details and glitches of customizing FT searches? Let me help you out! Here's code to help you create a customized search form, search criteria, and search results without saving a document on the back end!
CREATING THE SEARCH FORM:
You can create a form from scratch calling it whatever you like. By default, Domino uses $Search (the search.htm file in the notes/data/domino/icons directory), but that one doesn't look too pretty. The form property "Treat Contents as HTML" does NOT need to be checked.

On your form, create the following text fields: Query(computed), $$Return(computed), SaveOptions(editable). All fields should have the lower 6 hide properties checked.

Place "0" in the value of SaveOptions. (This prevents Domino from making a document out of the search result.)

Inside $$Return place the following code:

path := @ReplaceSubstring(@Subset(@DbName; -1); ""; "/");
string := "?SearchView&Query=";
view:= "/<viewYouwantToSearch>/";
"[[/" +path+view+string+Query+"]]"

Now, what do you want to search on? The best way to retrieve accurate results for you users, is to give them the corresponding values of the fields to search on. (i.e. Subject with a dialog list that retrieves Subject values using DBLookup)

There are many ways to write a query string. For simplicity, we'll use 'AND' as our seperator. In this case presume our UI field is UIsubject, and on the document the field is fldSubject.

Place the following code into Query:

sep:= " AND ";
string:= @LeftBack(@If(UIsubject!="";"FIELD fldSubject=" +UIsubject+sep;""); sep);

@If(string!="";"("+string+")";"")
You can do this for as many fields as you like that are on the document!

To complete it, create a button and place @Command([FileSave]);@Command([FileCloseWindow]) in the click event.

PART 2) THE RESULTS
Create a view of how your results should be displayed, we'll name it myView.

Create a form called $$Search Template for myView. Add a field called $$ViewBody (text, editable, no value). Your results will populate using myView as a table within this field.

Ugly relevancy boxes will show up in the first column. To hide these, include the following pass-thru HTML script prior to $$ViewBody. (This will hide all images in the table, so icons won't appear either.)

<style>TABLE IMG{display:hidden}</style>

To display the number of results, add a field named TotalHits (text,computed, value TotalHits, R5 only!). Then add text after:
Documents found.
Format it as you like. You should probably use computed text for the "s" in case only 1 doc is found. Formula: @If(TotalHits!="1";"s";"")

Add a pass-thru HTML link to search again on the bottom of the form just to complete it:

<a href="/databasePath/mySearchForm?OpenForm">Search Again</a>
or... Add a button w/ this formula:
@URLOpen("/databasePath/mySearchForm?OpenForm")

Questions? Check out the ancient SrchSite.ntf db design. It comes with Domino. Happy Searching!

This was first published in February 2001

Dig deeper on Lotus Notes Domino Administration Tools

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.UK

Close