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.
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
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.)
To display the number of results, add a field named TotalHits (text,computed, value TotalHits, R5 only!). Then add text after:
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:
Questions? Check out the ancient SrchSite.ntf db design. It comes with Domino. Happy Searching!