Domino Upgrade

Search

About Me

I am the "Lotus Technology & Productivity Advisor" for IBM Asia Pacific. I'm based in Singapore.
Reach out to me via:
Follow notessensei on Twitter
Yahoo IM
Skype
Sametime
IBM

Ads by Google

Twitter

Languages

Other languages on request.

Visitors

« XPages Custom Controls, what will you use? | Main| DXLMagic UI coming soon »

NotesDatabase.FTSearch vs NotesView.FTSearch

QuickImage When looking for data in a Notes database using LotusScript you have 3 possibilities: NotesView.getDocumentByKey (and its cousing NotesView.getEntryByKey), NotesDatabase.dbSearch and [NotesView|NotesDatabase].FTSearch. Use each of them wisely (when to use what might make another nice post). I want to focus on FTSearch for now. One would expect that a fulltext search against a view is substantial faster than against a whole database. However the results are quite different. The fulltext index is build once for the entire database. So even a FTSearch against a view will use the Index for the whole database. Searches are actually very fast. What makes a difference is how the results are processed and how you intend to use the result. If you plan to list them all out, there is no real difference. If you only want to show a subset continue reading. Very often a search returns 1000 documents but you only want to show 20 or 50 at a time. The core search returns an document collection that contains the UNIDs but not the document objects. When you use db.FTSearch the document objects are initialised when you loop through the collection as do a NotesDocumentCollection.getNextDocument(doc). So if you only use a fraction (50 of 1000) you would only initialize document objects 50 times. On a NotesView.FTSearch on the other hand the collection gets fully initialised since Domino needs to check if the document meets the view's selection criteria. If it matches the document stays in the result collection, if not it gets removed. So even if you would only use a few documents you would need to bear the waiting time of all document object initialisation calls. Unfortunately if you need a very specific sorting sequence you need to stick with a view. Andre gives more advice. In summary: in cases where your expected results are much bigger than what you want to show NotesDatabase.FTSearch beats NotesView.FTSearch

Post A Comment

Please note: Comments without a valid and working eMail address will be removed. This is my site, so I decide what stays here and what goes.

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::rolleyes:;-)

Disclaimer

This site is in no way affiliated, endorsed, sanctioned, supported, nor enlightened by Lotus Software nor IBM Corporation. I may be an employee, but the opinions, theories, facts, etc. presented here are my own and are in now way given in any official capacity. In short, these are my words and this is my site, not IBM's - and don't even begin to think otherwise. (Disclaimer shamelessly plugged from Rocky Oliver)

© 2003 - 2010 Stephan H. Wissel - all rights reserved as listed here: Creative Commons License
Unless otherwise labeled by its originating author, the content found on this site is made available under the terms of an Attribution/NonCommercial/ShareAlike Creative Commons License, with the exception that no rights are granted -- since they are not mine to grant -- in any logo, graphic design, trademarks or trade names of any type.

Get Firefox Use OpenDNS