Shai, was that irony or I am missing something big time? I would like to spare BytesRef -> String conversion, not to introduce another one back to BytesRef
Simply, for sorting, you do not need to do this byte[]->String conversion, byte representation of the String is perfectly sortable… On Mar 17, 2013, at 1:53 PM, Shai Erera <ser...@gmail.com> wrote: > You can do new BytesRef(d1.get("fieldName")). > > Shai > > > On Sun, Mar 17, 2013 at 2:43 PM, eksdev <eks...@googlemail.com> wrote: > is there any way to get ByteRef from a field originally stored as String? > > I am playing with Sorter to implement StoredDocSorter, analogous to > NumericDocValuesSorter. But realised I do not need ByteRef - > String > conversion just to compare fields (byte order would be as good for sorting) > > StoredDocument d1 = reader.document(docID1, fieldNamesSet); > String value1 = d1.get("fieldName") > String value1 = d1.getStringAsBytesValue("fieldName")// would love to have it > > I need String type in other places, so indexing as byte[] would be too much > hassle. > > String is internally stored as byte[], no reason not to expose it for > StoredField (or any other type)? > > >