You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "matthias-mueller (via GitHub)" <gi...@apache.org> on 2023/05/17 09:03:21 UTC

[GitHub] [lucene] matthias-mueller commented on a diff in pull request #12299: GITHUB-12291: Skip blank lines from stopwords list.

matthias-mueller commented on code in PR #12299:
URL: https://github.com/apache/lucene/pull/12299#discussion_r1196179445


##########
lucene/core/src/java/org/apache/lucene/analysis/WordlistLoader.java:
##########
@@ -53,7 +53,10 @@ public static CharArraySet getWordSet(Reader reader, CharArraySet result) throws
     try (BufferedReader br = getBufferedReader(reader)) {
       String word = null;
       while ((word = br.readLine()) != null) {
-        result.add(word.trim());
+        word = word.trim();
+        // skip blank lines
+        if (word.length() == 0) continue;

Review Comment:
   Should it better be `word.strip()`? https://stackoverflow.com/a/51266583



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org