Lucene.net 3.0.3不工作

时间:2021-06-17 03:09:17

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

我使用VS2010和lucene.net lib 3.0.3在我的asp.net项目中集成搜索功能。当我写

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'

“Lucene.Net.Store。FSDirectory'不包含'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.

为什么lucene.net 3.0.3仍然在阅读被剥夺的方法。我了解到GetDirectory()方法是在Apache的这个网站上被剥夺的。

Any solution please?

任何解决方案吗?

1 个解决方案

#1


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.

您应该尝试获取目录方法。或者请检查您是否知道,这个目录打开方法在以前的lucene版本中。

please look at

请看看

http://guntucomputerhacks.blogspot.com.au/2014/08/basic-indexing-and-searching-example.html

http://guntucomputerhacks.blogspot.com.au/2014/08/basic-indexing-and-searching-example.html

          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();

Hope this helps.

希望这个有帮助。

#1


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.

您应该尝试获取目录方法。或者请检查您是否知道,这个目录打开方法在以前的lucene版本中。

please look at

请看看

http://guntucomputerhacks.blogspot.com.au/2014/08/basic-indexing-and-searching-example.html

http://guntucomputerhacks.blogspot.com.au/2014/08/basic-indexing-and-searching-example.html

          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();

Hope this helps.

希望这个有帮助。