Efficient searching in a view

Hi!

I’m performing search for a document that contains a particular text field with the same contents as that of another document.

Currently using a getview and doing a for loop to

1)get each document

2)check if field contents are same as the other documents’ field

This works, however since i have more than 20 documents per day, searching thru a database of even say, a month, would be a long processing time.

Kindly suggest ways to improve search.

Love and Light

Larry

Subject: Efficient searching in a view

Full Text Index your database, then use some code like this to get your collection (which might be just one doc)2 examples illustrated within this snippet… view search and db search… notes designs the database for efficient full text searching.

Dim s As New NotesSession

Dim db As NotesDatabase

Set db = s.currentdatabase

Dim coll As NotesDocumentCollection

Dim colldoc As NotesDocument

'Dim view as NotesView

'Set view = db.GetView(“EBM”)

lookup = “Major Tom”

'query = |(FIELD FORM CONTAINS “Document”) AND (FIELD First_Name CONTAINS “| + lookup + |”)|

query = |FIELD First_Name CONTAINS “| + lookup + |”|

'j = view.FTSearch( query, 0 ) 'j now contains the count

Set coll = db.FTSearch(query, 0)

Once you have a collection, here is how to iterate:

Set colldoc = coll.GetFirstDocument

While Not (colldoc Is Nothing)

stringvariable = colldoc.GetItemValue( “fieldname” )(0)

Set colldoc = coll.GetNextDocument(colldoc)

Wend

Subject: RE: Efficient searching in a view

In my opinion the same result can be obtained by using DB.Search instead of doing Db.FTsearch or view.FTsearch as both requires database to be full text indexed.

Also, if index is not updated the search won’t yield accurate results.

Thanks and Regards,

Munish