[ 
https://issues.apache.org/jira/browse/LUCENE-7361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15354281#comment-15354281
 ] 

David Smiley commented on LUCENE-7361:
--------------------------------------

MemoryIndex is doing this itself.  And if not this issue then in a separate 
issue I think we should improve it (using the WIP code attached here as a 
straw-man) so that it simply uses the Lucene public 
Terms/TermsEnum/PostingsEnum APIs rather than needlessly using its internal 
implementation data which led to a bug.  Terms is Terms... why should 
MemoryIndex be different?  The only thing different I see is that MemoryIndex 
is going to be not as huge as a main index (in general) so, subjectively, it 
can sorta get away with overriding toString vs some other method.  I'd actually 
rather it didn't -- leaving term & position details be on another method to 
avoid toString() getting humungous.  Where I'm coming at this is that it'd be a 
shame if this debugging utility only existed on MemoryIndex since the code 
doesn't really care about MemoryIndex specifics; MI has no specifics -- it's an 
index, albeit a small one.

At times I've wished to view an index I'm debugging that I'm writing tests for, 
which has a small amount of data as it's the unit/test data.  SimpleTextCodec 
is one option but it's very inconvenient to switch to and switch to a non-RAM 
directory vs. a hypothetical diagnostic method on Fields / Terms when I'm 
already in the debugger poking around.  Doesn't that seem useful to you too?

> Terms.toStringDebug
> -------------------
>
>                 Key: LUCENE-7361
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7361
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: David Smiley
>         Attachments: MemoryIndexToString.java
>
>
> While fixing LUCENE-7340, MemoryIndex.toString(), I thought MemoryIndex 
> shouldn't need it's own debug toString() impl for its Terms when there could 
> be a generic one.  So here I propose that we create a 
> Terms.toStringDebug(Appendable result, int charLimit, String indent) or 
> some-such but probably not override toString() for obvious reasons.  Maybe 
> also have this on Fields() that simply loops and calls out to the one on 
> Terms.
> The format is debatable.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to