Pranay B
Pranay B

Reputation: 67

Lucene.net 3.0.3 not working

Im using VS2010 and lucene.net lib 3.0.3 for integrating the search functionality in my asp.net project. When I write

Lucene.Net.Store.Directory directory = 
    Lucene.Net.Store.FSDirectory.Open(directoryPath);

Intellisense is saying:

'Lucene.Net.Store.FSDirectory' does not contain a definition for 'Open'

Why the lucene.net 3.0.3 is still reading the depricated methods. I learned that GetDirectory() method is depricated from this website of Apache.

Any solution please?

Upvotes: 3

Views: 941

Answers (1)

You should try get directory method. Or please check if you have any as far my knowledge that, this directory open method was in previous lucene versions.

FSDirectory objDirectory = FSDirectory.GetDirectory(pstrDatabase_path);
Analyzer Analyzer = new StandardAnalyzer();
IndexWriter Writer = new IndexWriter(objDirectory, Analyzer);
Document doc = new Document();
doc.Add(new Field("FIELD_NAME", "FIELD_VALUE" , Field.Store.YES, 
Field.Index.NOT_ANALYZED));
Writer.AddDocument(doc);
Writer.Commit();
Writer.Close();

Upvotes: 1

Related Questions