bruno-roustant commented on code in PR #13431: URL: https://github.com/apache/lucene/pull/13431#discussion_r1617111686
########## lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/UserDictionary.java: ########## @@ -168,33 +171,53 @@ public UserMorphData getMorphAttributes() { * @return array of {wordId, position, length} */ public int[][] lookup(char[] chars, int off, int len) throws IOException { - // TODO: can we avoid this treemap/toIndexArray? - TreeMap<Integer, int[]> result = new TreeMap<>(); // index, [length, length...] Review Comment: The TreeMap sorting was not required because we add segmentations (wordIfAndLength) in ascending order of the position (startOffset - off). I think it allowed to keep the iteration order and also allocated less memory than a LinkedHashMap. It is now replaced by a List of Match records (position, wordIfAndLength). -- 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-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org