private void Index(string filePath) { Stream stream; if (!WaitForFileUnlocked(filePath, out stream)) { return; } var document = new Document(); document.AddField(new StringField(NameField, filePath, FieldFlags.Stored)); document.AddField(new TextField(ContentField, stream, FieldFlags.Analyzed)); _searchIndex.RemoveDocument(new Term(NameField, filePath)); _searchIndex.AddDocument(document); }