Home > Domino Tips > Developer > HTML > Customized Web Searching at Last!
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

HTML

Customized Web Searching at Last!


Angie Schottmuller
02.01.2001
Rating: -3.80- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


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!

Code

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!

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
HTML
Create a dynamic fluid image gallery with Lotus Notes views
Write HTML and JavaScript in Notes view rows and columns on the Web
Open Lotus Notes documents in Microsoft Word without coding
Trap an attachment path via the Domino file upload control field
A bevy of Notes/Domino development tips
Styling Lotus Domino Web fields
How to convert Microsoft Word or Microsoft Excel documents to HTML
An easier way to view multiple columns on the Web
How to print a form in landscape format automatically
Tip contest winner: Hide view column while being able to sort it

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts