You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/04/28 08:32:51 UTC

[GitHub] [lucene] rmuir commented on a diff in pull request #850: LUCENE-10541: limit the default length of MockTokenizer tokens to 255.

rmuir commented on code in PR #850:
URL: https://github.com/apache/lucene/pull/850#discussion_r860626938


##########
lucene/test-framework/src/java/org/apache/lucene/tests/analysis/MockTokenizer.java:
##########
@@ -66,11 +67,11 @@ public class MockTokenizer extends Tokenizer {
    * Limit the default token length to a size that doesn't cause random analyzer failures on
    * unpredictable data like the enwiki data set.
    *
-   * <p>This value defaults to {@code CharTokenizer.DEFAULT_MAX_WORD_LEN}.
+   * <p>This value defaults to {@link IndexWriter#MAX_TERM_LENGTH}.
    *
    * @see "https://issues.apache.org/jira/browse/LUCENE-10541"
    */
-  public static final int DEFAULT_MAX_TOKEN_LENGTH = 255;
+  public static final int DEFAULT_MAX_TOKEN_LENGTH = IndexWriter.MAX_TERM_LENGTH;

Review Comment:
   This tokenizer counts UTF-32 codepoints i think? Which is another thing entirely :)
   
   But still 255 is fine, as 255*4 is still far less than IndexWriter's limit. 
   
   I think it is a good change. *ALL* the "real" analyzers have limits here. they have setters to tweak, too. Even KeywordTokenizer! So the problem of tokenizer emitting huge term is limited to MockTokenizer... let's fix it.



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