Error when updating an index in LotusScript

Hi,

I recently deployed some a new piece of search functionality for an existing application, and have experienced a few rather mysterious problems in its behaviour, and I haven’t managed to find out why in the Notes help or in this or the R5 forum.

The problem is called by one line of code - it’s the third line of executable code in a web agent, running as the server, with execution access set to level 2. The first two lines are setting the session and database objects.

The code is simply :

If db.LastModified > db.LastFTIndexed Then Call db.UpdateFTIndex(False)

Now here’s the weird behaviour:

If I run the code as myself (db manager access), everything works as expected without errors. However, if the code runs as other users (including other db managers), they occassionally encounter the following error the first time they submit a search request but not on subsequent runs:

Notes error: Database is currently being indexed by another process

A resume next statement forces the code to continue running, but then when it reaches the line to perform the search it errors again with the following:

Notes error: The full text index needs to be rebuilt

Again, I stress that this error doesn’t ever occur when I run a search logged in as myself.

I’d always assumed that the code will wait for an index to be updated before continuing with the rest of the agent. In the past I’d used this on R5 for a search routine accessed by a lot more people than the current app I’m working on, and never encountered this error.

Can anyone explain why this is happening? I have temporarily rem’d this line out of the agent for the meantime and the errors have stopped occuring.

Subject: Error when updating an index in LotusScript

Only DB Managers can create or update indexes. You can try this manually on a database and you will see the index options are greyed out if you are not the manager.

Subject: RE: Error when updating an index in LotusScript

Sorry - should have mentioned - some of the other users are managers so that’s not the problem. Plus, if you read the post you’ll see the agent is running as the server so it should make no difference who’s running it.

I’ve updated the original post. Any other ideas?

Subject: Undocumented Bug / “Feature” using If statement in conjunction with UpdateFTIndex method

Just to follow up on this, I spoke to IBM/Lotus, and predictably they simply quoted the example from the help at me. I must admit I wasn’t very happy, as I’d used the line below more than 40 times in the past with R5 and never had a problem.

If db.LastModified > db.LastFTIndexed Then Call db.UpdateFTIndex(False)

Anyway, in the help the line is shown like so:

If (db.LastModified > db.LastFTIndexed) Then Call db.UpdateFTIndex(False)

I thought - hey, big deal - this shouldn’t make any difference at all in theory. However, oddly enough, putting the parentheses in stopped the errors I had been getting.

The guy at Lotus insisted that the help specified this, to which I countered that the help for If and If Then Else one line statements does not suggest at any point that the conditions of the statement need to be surrounded by parentheses, and that this type of statement still works without hinderance for all other methods, etc. In addition, even the syntax on the help for the UpdateFTIndex method of the notesdatabase class doesn’t make any mention of parentheses when using the method in conjunction with an If statement.

So there you have it LotusScript programmers.

If I’m wrong, someone please let me know but given what I can see in the notes help it looks unlikely.

Subject: *I haven’t seen it before. That could mean a change to a lot of apps.

Subject: <Error - REPOST>

Subject: Re: Error when updating an index in LotusScript

I’m seeing some similar behavior on an ND6.5 server. The same code ran find on 5.0.11.

I’ll do some testing and post my results.