Help with Domino search model

I need some help understanding the Domino model. I want to search for a Person document, then hold some unique identifier for it so that I can retrieve it again, later. So, in pseudo-code

PersonDocs = Database.Search(LastName contains ‘Smith’)

for each (PersonDoc in PersonDocs)

if (condition)

    UniqueID = PersonDoc.UniqueID

later

PersonDoc = Database.Get(UniqueID)

process(PersonDoc)

Is this the right paradigm (can’t believe I’m using that word in anger)?

Basically, this is the way I’m retrieving user details from LDAP. Can I do this or something similar?

Subject: Help with Domino search model

“Is this the right paradigm (can’t believe I’m using that word in anger)?”

I wonder what exactly about this flow of control feeds your anger. If you provide some more info about what you finally want to achieve (e.e.g there is probably a reason, why you must retrieve the document “later”), there might even be more efficient ways to do so. No guarantees here, but it could just be.

Subject: RE: Help with Domino search model

I think my comment was lost in translation.

It’s for identity management. I need to query a NAB person document and may need to update the document later, depending on the response from the user. The ‘later’ might be hours later in the day, or even days later, so I don’t want the server to have to hold onto the actual object references because it could run out of resources. Better to hold the ‘address’ of the object and re-open it later. At least, that’s what I’ve assumed.

Subject: RE: Help with Domino search model

Do you mean for configuring (or writing?) a connector of some external identity management system? I’m still not sure if this is a good idea.

I what programming language would you write that code? If you do it accessing Lotus Notes object classes, would you want to keep a session open until there might be a need to update the document? If not, where would you store that UniversalID (or DocumentUniqueId)?

Even if this is not very likely: The DocumentUniqueId of a person document COULD change during it’s lifetime. If you come from a relational background, you might have been happy to find, that the UnId seems to work like a primary or unique key. Well, yes and no. The key is unique amongst all documents, but Domino doesn’t rely on it being the same too much. You would not do that just for fun, but it could just happen, that a Domino administrator had to recreate a user’s person document (with identical content, but different DocumentUniqueId). Domino wouldn’t really bother, as long as the users full canonical name (the first entry in the field FullName) is still the same and unique.

In a worst case, it could even be, that a whole Domino Directory would have to be copied (Notes copy, not file system copy), which would lead to all person docs getting new DocumentUniqueIds. As I said, nobody will do so just for fun (it would have severe impact on an environment with multiple replicating Domino servers and quite a bit of additional work would be necessary), but still it could just happen.

Also, performing a full-text search might not be the most efficient way to retrieve person documents. If a full-text index has been created for the Domino directory, it is something like a save bet to get anything in return. But depending on what you need, the GetDocumentByKey method of a NotesView object might be both, faster and more flexible. E.g. it takes an argument to determine, if the key must be matched exactly, or if it should just match the beginning of a value.

Could be I’m going over the top here and all this is not relevant for what you have to do, but at least I can say: You have been warned. :slight_smile:

Subject: RE: Help with Domino search model

Thanks for the email - your explanation has increased my understanding of Domino further.

No, I’m not talking about writing a connector (although if I was, it would be okay even if the Person document was deleted because if the UniqueID disappeared from Domino, I would break the connector and rerun the matching algorithm). But what I’m talking about is shorter term. It’s part of the matching process - the program runs on the client machine at logon and requests information. i’ve discovered that if users don’t have the information to hand, they’ll leave the program open, sometimes until logoff, which might not be the same day. So, I open Domino, look up the person document, get the details, get the UNID and hold onto it. Then if the user supplies the info, I re-open the doc using the UnID. If it’s got, I re-run the search. At least, that’s the plan.

I do wish Domino had a proper distinguishedName a la LDAP directories,though. It would make life so much easier.

Subject: RE: Help with Domino search model

Hmm, I don’t know what would server your needs, but it kind of has. Every user has an absolutely unique hierarchical name like

CN=Harkpabst Meliantrop/OU=Development/O=LunaticSolutions/C=DE

This is just a made up example, of course. Note that the C component is optional for Domino names, but there can be between 0 and 4 organizational units. The syntax is slightly different from LDAP distinguished names, but the meaning is the same.

Unfortunately, it seems that dn or distinguishedName are not mapped to a corresponding field by default. And I really know too little about LDAP to decide, how this should be done best. You should be able to connect to Domino using any LDAP browser and see, what is available and what not.

Subject: RE: Help with Domino search model

Thanks for your help. I will have a rummage around and see what suits the application

Subject: Help with Domino search model

Yes, this is the right paradigm. If you are using LotusScript, you will want to read up on some of the following:

DocumentCollection class (this will be the class of your ‘PersonDocs’)

NotesDatabase Search method (you should also look at the FTSearch method, especially if you have a large directory)

GetFirstDocument, GetNextDocument (for iterating over the collection)

NotesDatabase UniversalID property (for your unique identifier of a document)

NotesDatabase GetDocumentByUNID property for retrieving the document in a later step.

Hope that helps!

Subject: RE: Help with Domino search model

It does, thanks very much. That’s exactly what I was looking for.