0

I am beginning to learn Lucene.Net and was wondering how you declare the version number?

Here is what I have, but it doesn't work:

var analyzer = new StandardAnalyzer(Version.LUCENE_30); //Version.Lucene_30 is where the problem lies. 

I have also tried:

var analyzer = new StandardAnalyzer(Lucene.Net.Util.Version);

but get the same result.

BowerdotJson
  • 55
  • 1
  • 9
  • What doesn't work? Describe you problem clearly. Also, your second attempt doesn't make sense, as you are supplying an enum class as the parameter. – Setsu Aug 05 '15 at 17:59

1 Answers1

2

To declare the version of Lucene.Net you can create a variable:

var version = Lucene.Net.Util.Version.LUCENE_30;

After this just add the variable into the StandardAnalyzer argument:

var analyzer = new StandardAnalyzer(version);
BowerdotJson
  • 55
  • 1
  • 9
  • Your solution is correct but you conclusion is wrong; you do not need to declare the version of Lucene.Net as a variable, but you _do_ need to include the namespace of the class. If you had a simple `using Lucene.Net.Util.Version;` statement your first attempt in the question would have worked. – Setsu Aug 05 '15 at 18:02
  • I tried to add the namespace you suggested, it did not work. – BowerdotJson Aug 05 '15 at 18:40
  • Again "did not work" is too vague; what specifically failed and what error messages did it give you? – Setsu Aug 05 '15 at 20:25
  • Specifically, there are two errors. The first says "C#: Expected a namespace". The second says "This using directive is not required." The program works fine now, that's why I said your method "did not work." – BowerdotJson Aug 05 '15 at 20:33