You can do new BytesRef(d1.get("fieldName")).

Shai


On Sun, Mar 17, 2013 at 2:43 PM, eksdev <[email protected]> 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)?
>
>
>

Reply via email to