In the SortedDocValues.lookupOrd documentation it says that a deep
copy is needed for the returned BytesRef. I wanted to verify that this
was actually true. I'm
trying to see a way that this BytesRef could be safely reused by the
API but I don't see one. Is there actually an implementation of
lookupOrd that somehow reuses the
same BytesRef between invocations. The java doc is copied below:
Thanks!
/** Retrieves the value for the specified ordinal. The returned
* {@link BytesRef} may be re-used across calls to {@link #lookupOrd(int)}
* so make sure to {@link BytesRef#deepCopyOf(BytesRef) copy it} if you want
* to keep it around.
* @param ord ordinal to lookup (must be >= 0 and < {@link
#getValueCount()})
* @see #ordValue()
*/
public abstract BytesRef lookupOrd(int ord) throws IOException;
Joel Bernstein
http://joelsolr.blogspot.com/