AnsweredAssumed Answered

Lucene Indexing Problem using WebScripts

Question asked by kumbach on May 16, 2008
Latest reply on Aug 11, 2008 by kumbach
We're running into a frustrating indexing issue that I'm trying to solve.

I have a space named Company Home/Additions. Users with write permission can create documents in there. Simple, and works well.

In the background, I have a scheduled task that runs a WebScript that checks for new documents in Company Home/Additions every minute. If it sees a new document in there, it simply moves it to a different space that the person who created the document doesn't have write access to. Since the script runs in the background as the Admin user, this all works well. Except…

Quite often, the Lucene indexes are getting out of sync with the repository. What I see happening is that the Lucene search that the script uses to look for new documents in the Additions space finds documents that are no longer there. Then when the script tries to move the document to a different space, it throws an error saying the document doesn't exist.

What's interesting is that if I go into the node browser and do a Lucene search, the problem document shows up as being in the Additions folder. But if I descend through the child nodes from Company Home to Additions, the document does not show up in there.  And, if I browse to the folder that the script initially tried to move the document to, it shows up there. This is how I determined that the Lucene index is being corrupted.

The only way I have found to fix this is to do a full Lucene index rebuild. But this is not practical because it may take several hours to do that and we can't afford that system downtime.

Although I discovered this problem initially through WebScripts, I have recoded the process using the Foundation Services and have run into the same problem.

Does anyone have insight into what might be causing this problem? Has anyone run into this situation before? I'd really appreciate hearing from anyone if they have.