[jira] [Updated] (LUCENE-8575) Improve toString() in SegmentInfo

2018-11-28 Thread Namgyu Kim (JIRA)


 [ 
https://issues.apache.org/jira/browse/LUCENE-8575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Namgyu Kim updated LUCENE-8575:
---
Attachment: LUCENE-8575.patch

> Improve toString() in SegmentInfo
> -
>
> Key: LUCENE-8575
> URL: https://issues.apache.org/jira/browse/LUCENE-8575
> Project: Lucene - Core
>  Issue Type: Improvement
>  Components: core/index
>Reporter: Namgyu Kim
>Priority: Major
> Attachments: LUCENE-8575.patch, LUCENE-8575.patch
>
>
> I saw the following code in SegmentInfo class.
> {code:java}
> // TODO: we could append toString of attributes() here?
> {code}
> Of course, we can.
>  
> So I wrote a code for that part.
> {code:java}
> public String toString(int delCount) {
>   StringBuilder s = new StringBuilder();
>   s.append(name).append('(').append(version == null ? "?" : 
> version).append(')').append(':');
>   char cfs = getUseCompoundFile() ? 'c' : 'C';
>   s.append(cfs);
>   s.append(maxDoc);
>   if (delCount != 0) {
> s.append('/').append(delCount);
>   }
>   if (indexSort != null) {
> s.append(":[indexSort=");
> s.append(indexSort);
> s.append(']');
>   }
>   // New Code
>   if (!diagnostics.isEmpty()) {
> s.append(":[diagnostics=");
> for (Map.Entry entry : diagnostics.entrySet())
>   
> s.append("<").append(entry.getKey()).append(",").append(entry.getValue()).append(">,");
> s.setLength(s.length() - 1);
> s.append(']');
>   }
>   // New Code
>   if (!attributes.isEmpty()) {
> s.append(":[attributes=");
> for (Map.Entry entry : attributes.entrySet())
>   
> s.append("<").append(entry.getKey()).append(",").append(entry.getValue()).append(">,");
> s.setLength(s.length() - 1);
> s.append(']');
>   }
>   return s.toString();
> }
> {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Updated] (LUCENE-8575) Improve toString() in SegmentInfo

2018-11-27 Thread Namgyu Kim (JIRA)


 [ 
https://issues.apache.org/jira/browse/LUCENE-8575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Namgyu Kim updated LUCENE-8575:
---
Attachment: LUCENE-8575.patch

> Improve toString() in SegmentInfo
> -
>
> Key: LUCENE-8575
> URL: https://issues.apache.org/jira/browse/LUCENE-8575
> Project: Lucene - Core
>  Issue Type: Improvement
>  Components: core/index
>Reporter: Namgyu Kim
>Priority: Major
> Attachments: LUCENE-8575.patch
>
>
> I saw the following code in SegmentInfo class.
> {code:java}
> // TODO: we could append toString of attributes() here?
> {code}
> Of course, we can.
>  
> So I wrote a code for that part.
> {code:java}
> public String toString(int delCount) {
>   StringBuilder s = new StringBuilder();
>   s.append(name).append('(').append(version == null ? "?" : 
> version).append(')').append(':');
>   char cfs = getUseCompoundFile() ? 'c' : 'C';
>   s.append(cfs);
>   s.append(maxDoc);
>   if (delCount != 0) {
> s.append('/').append(delCount);
>   }
>   if (indexSort != null) {
> s.append(":[indexSort=");
> s.append(indexSort);
> s.append(']');
>   }
>   // New Code
>   if (!diagnostics.isEmpty()) {
> s.append(":[diagnostics=");
> for (Map.Entry entry : diagnostics.entrySet())
>   
> s.append("<").append(entry.getKey()).append(",").append(entry.getValue()).append(">,");
> s.setLength(s.length() - 1);
> s.append(']');
>   }
>   // New Code
>   if (!attributes.isEmpty()) {
> s.append(":[attributes=");
> for (Map.Entry entry : attributes.entrySet())
>   
> s.append("<").append(entry.getKey()).append(",").append(entry.getValue()).append(">,");
> s.setLength(s.length() - 1);
> s.append(']');
>   }
>   return s.toString();
> }
> {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org