Assuming I have assured that only one thread from one process is calling the
below methods, is there any issue with calling

DeletePost(post.Id);
AddPostToIndex(post);

in terms of potentially corrupting the index? I can't see any. But I've
suddenly got paranoid about index corruption. IndexModifierSingleton is just
that, a singleton for the IndexModifier. The IndexReader is not, since I
wanted a fresh reader for each delete operation.



       private static void DeletePost(int feedItemId)
       {
           IndexReader ir = IndexReader.Open(IndexPath());
           ir.DeleteDocuments(new Term(Post.FIELD_FEEDITEMID,
feedItemId.ToString()));
           ir.Close();
       }


       public static string IndexPath()
       {
           return Settings.Default.IndexPath;
       }

       public static void AddPostToIndex(Post post)
       {
           IndexModifierSingleton.instance.AddDocument(post.ToDocument());
       }


--
-
P

Reply via email to