Title Back Colour Keyoti Title Line Title Curve
Blue Box Top

Simultaneous operations on index - SearchUnit - Forum

Welcome Guest Search | Active Topics | Log In | Register

Options
DMacy
#1 Posted : Wednesday, May 26, 2021 5:21:57 PM
Rank: Advanced Member

Groups: Registered

Joined: 9/1/2010
Posts: 136
I am retrieving a document from an index by its uri. Sometimes I get an exception about running two simultaneous operations on the index. If I wait a minute and try again, it usually works. What do I need to do to avoid this error?

The line of code I'm using is:

Dim TestDoc As Keyoti.SearchEngine.Documents.Document = LibIndex.GetDocument(New Uri("https://domain.com/la1234"))

I anticipate putting this code in a loop where I want to examine one document after another, deciding whether to update it or not.
Jim
#2 Posted : Wednesday, May 26, 2021 9:27:09 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,669
Location: Canada
The simultaneous operations exception happens when you try to create a DocumentIndex object while the index directory is locked (has a lock file in it).

So that might happen for example if you have two threads that create DocumentIndex, or 2 totally different processes that are doing this.

Another way is if you do this

i = New DocumentIndex(c)
'....
i = New DocumentIndex(c)

without calling DocumentIndex.Close, eg. you would fix that like

i = New DocumentIndex(c)
'....
i.Close()
i = New DocumentIndex(c)

-your feedback is helpful to other users, thank you!


DMacy
#3 Posted : Wednesday, May 26, 2021 10:07:32 PM
Rank: Advanced Member

Groups: Registered

Joined: 9/1/2010
Posts: 136
Thanks, Jim! I just needed to add LibIndex.Close at the end and it worked. I had forgotten that detail. Thanks for your help!
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.




About | Contact | Site Map | Privacy Policy

Copyright © 2002- Keyoti Inc.