You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/02/25 20:12:34 UTC

[GitHub] [solr] dweiss commented on a change in pull request #712: SOLR-16059: FieldType.DefaultAnalyzer: correct reader.read() loop and…

dweiss commented on a change in pull request #712:
URL: https://github.com/apache/solr/pull/712#discussion_r815091648



##########
File path: solr/core/src/java/org/apache/solr/schema/FieldType.java
##########
@@ -502,24 +502,51 @@ public Query getPrefixQuery(QParser parser, SchemaField sf, String termStr) {
     @Override
     public TokenStreamComponents createComponents(String fieldName) {
       Tokenizer ts = new Tokenizer() {
+        private boolean done = false;
+        private int finalOffset;
+
         final char[] cbuf = new char[maxChars];
         final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
         final BytesTermAttribute bytesAtt = isPointField() ? addAttribute(BytesTermAttribute.class) : null;
         final OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class);
+
         @Override
         public boolean incrementToken() throws IOException {
-          clearAttributes();
-          int n = input.read(cbuf,0,maxChars);
-          if (n<=0) return false;
-          if (isPointField()) {

Review comment:
       This stream reading idiom is wrong. read is not required to read fully.




-- 
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@solr.apache.org

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



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