File tree Expand file tree Collapse file tree 1 file changed +2
-24
lines changed
server/src/main/java/org/elasticsearch/index/fielddata Expand file tree Collapse file tree 1 file changed +2
-24
lines changed Original file line number Diff line number Diff line change @@ -631,28 +631,9 @@ public String get(int index) {
631631 return values [index ].get ().utf8ToString ();
632632 }
633633
634- public BytesRef getBytesValue () {
635- if (size () > 0 ) {
636- /**
637- * We need to make a copy here because {@link BinaryScriptDocValues} might reuse the
638- * returned value and the same instance might be used to
639- * return values from multiple documents.
640- **/
641- return values [0 ].toBytesRef ();
642- } else {
643- return null ;
644- }
645- }
646-
647634 public String getValue () {
648- BytesRef value = getBytesValue ();
649- if (value == null ) {
650- return null ;
651- } else {
652- return value .utf8ToString ();
653- }
635+ return count == 0 ? null : get (0 );
654636 }
655-
656637 }
657638
658639 public static final class BytesRefs extends BinaryScriptDocValues <BytesRef > {
@@ -672,10 +653,7 @@ public BytesRef get(int index) {
672653 }
673654
674655 public BytesRef getValue () {
675- if (count == 0 ) {
676- return new BytesRef ();
677- }
678- return values [0 ].toBytesRef ();
656+ return count == 0 ? new BytesRef () : get (0 );
679657 }
680658
681659 }
You can’t perform that action at this time.
0 commit comments