lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [lucenenet] roysurles opened a new issue #246: Custom StopWord Analyzer - Exception Cannot read from a closed TextReader.
Date Tue, 28 Apr 2020 15:22:48 GMT

roysurles opened a new issue #246:

   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 to
implement this method, we are getting exception:  "Cannot read from a closed TextReader."
   Here is our implementation:
           protected override TokenStreamComponents CreateComponents(string fieldName, TextReader
               Analyzer analyzer = new StandardAnalyzer(_luceneVersion, reader);
               TokenStream ts = analyzer.GetTokenStream(fieldName, reader);
               var tokenizer = new StandardTokenizer(_luceneVersion, reader);
                   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;
               return new TokenStreamComponents(tokenizer, ts);
   The exception occurs on ts.IncrementToken().

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:

View raw message