[ https://issues.apache.org/jira/browse/LUCENE-10398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17489078#comment-17489078 ]
Greg Miller commented on LUCENE-10398: -------------------------------------- While I haven't looked into what it might take to implement this, +1 to the idea. A static factory method for loading terms with behavior similar to those found in {{DocValues}} would be beneficial. To motivate this a bit more, it might be useful to look at some of the places where terms are loaded today to see if the code would get simpler with this proposed factory method. Would it allow lots of code to eliminate null checks for example? Or would we maybe not do that anyway because the null checking logic allows for additional optimizations that wouldn't be available with an empty terms iterator? > Add static method for getting Terms from LeafReader > --------------------------------------------------- > > Key: LUCENE-10398 > URL: https://issues.apache.org/jira/browse/LUCENE-10398 > Project: Lucene - Core > Issue Type: Improvement > Reporter: Marc D'Mello > Priority: Minor > > Hi all, {{LeafReader}} has methods like {{getBinaryDocValues(String field)}} > that return {{null}} values if the field is not indexed. These methods also > have equivalent {{DocValues}} static methods, such as > {{DocValues.getBinary()}}, which return an {{emptyBinary()}} rather than a > {{null}} if there is no field. I noticed that {{Terms}} does not have an > equivalent static method for {{LeafReader.terms()}} like {{Terms.terms()}} or > something similar. I was wondering if there was a reason for this, or if a > method like this could be useful. Thanks! -- This message was sent by Atlassian Jira (v8.20.1#820001) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org