roysurles opened a new issue #246: URL: https://github.com/apache/lucenenet/issues/246
Hello, We are trying to convert from v3.0.3 to v4.8.0-beta00007. .Net Framework 4.5. We previously had a Custom StopWork Analyzer that inherited from Analyzer. After upgrading, there is an abstract method that needs to be implemented named: TokenStreamComponents CreateComponents(string fieldName, TextReader reader) Following the documentation from https://lucenenet.apache.org/download/version-4.html to implement this method, we are getting exception: "Cannot read from a closed TextReader." Here is our implementation: <code> protected override TokenStreamComponents CreateComponents(string fieldName, TextReader reader) { Analyzer analyzer = new StandardAnalyzer(_luceneVersion, reader); TokenStream ts = analyzer.GetTokenStream(fieldName, reader); var tokenizer = new StandardTokenizer(_luceneVersion, reader); try { ts.Reset(); // Resets this stream to the beginning. (Required) while (ts.IncrementToken()) { } ts.End(); // Perform end-of-stream operations, e.g. set the final offset. } catch (Exception ex) { _ = ex.Message; throw; } finally { ts.Dispose(); } return new TokenStreamComponents(tokenizer, ts); } </code> The exception occurs on ts.IncrementToken(). Thanks Roy ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
