Urgent: Creating a search form to search different views within one database

Morning!

I know this has been covered in parts in previous forum posts, but I am very stuck on this.

Basically I am aware that by creating a full-text index of a database, we can then bring up the search bar in a view and search that view for any documents containing the search value.

In my situation, I have several views. One for companies, one for contacts. I would like to have a link on my nav bar that brings up a customised search box, where users can enter a search value, and select whether they are searching companies, contacts or both. The results would need to be displayed in a single results view. So, for example, if there is a company called Austin (in the Comapanies view), and also a contact called Austin (in the Contacts view), then the search results will return two entries in a view, one linking to the contact, and one to the company.

Don’t know where to start!

Thanks a lot!

Duncan

Subject: Urgent: Creating a search form to search different views within one database

On web, you can create a global view and do a searchview query with good parameter.On Notes side, you can make several ftsearch or dbsearch(bad performance) and move the results into a private folder (POFU).

Damien

Subject: RE: Urgent: Creating a search form to search different views within one database

Here a code that put all result of a ftsearch into a view private of first use.The statement “session.NotesBuildVersion<190 …” is use in my firm because we use a notes client 601 and there is a bug.

For web search everything is explained in the old redbooks : sg242183.pdf “Developing web applications using lotus notes designer for domino 4.6”

Regards


Sub Initialize

Dim workspace As New NotesUIWorkspace

Dim session As New NotesSession

Dim db As NotesDatabase	

Dim folder As Notesview

Dim view As notesview



Dim vc As NotesViewEntryCollection



' Recherche des documents

Set db = session.CurrentDatabase

Set view = db.GetView("v_Alldoc")	

'**************

'Correctif pour client Lotus V6

'**************

If session.NotesBuildVersion<190 Then    'Si execution sous R5 utiliser GetView. 

	Set folder = db.GetView("D_DossierResultats")

Else                                                            'si R6 faire boucle 

	Forall v In db.Views 

		'on doit mettre le nom du dossier et pas son alias

		If v.name="DossierResultats" And Isarray(v.readers) Then 

			

			If v.readers(0)=session.UserName Then 

				Set folder=v

				Exit Forall 

			End If 

		End If 

	End Forall 

End If 

 'maintenant folder est bien une occurence du dossier privé à la premiere utilisation 

'**************



' Construction de la requête

query$ = workspace.currentdocument.document.qry_gestion(0)



' Execution de la requête

n = view.FTSearch(query$,0)



' Vide la dossier

On Error Goto ErrorHandle



Set vc = folder.AllEntries

If vc.count>0 Then

	Call vc.RemoveAllFromFolder("D_DossierResultats")		

End If

%REM

'************************************* 

Set vc=view.Allentries

Set ventry=vc.GetFirstEntry

While Not ventry Is Nothing

	Set doc=ventry.document

	Call doc.PutInFolder("D_ResultRech_FR")	

	

	Set ventry=vc.GetNextEntry(ventry)

Wend

'************************************* 

%END REM

' Remplit le dossier avec le resultat de la requête

Set vc = view.AllEntries

Call vc.PutAllInFolder("D_DossierResultats")	

Exit Sub

ErrorHandle:

If (Err = 4005) Then

	Messagebox "Attention, ceci est votre 1ère recherche :" & Chr$(10) & _ 

	"Aucun résultat ne sera renvoyé du fait de la mise en place de l'environnement de recherche." & Chr$(10) & _ 

	"Veuillez renouveller l'opération...",48,"Avertissement"

Else

	Messagebox "Attention, la recherche ne peut pas fonctionner" & Chr$(10) & _

	"Un des documents a subit un conflit, contacter votre POA"

End If

Exit Sub

End Sub