You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "Osborn, Kevin" <Ke...@pgi.com> on 2016/09/29 18:23:25 UTC
Convert BytesRef to long in Solr 6.2
I have the following code inside a Solr post filter.
SortedDocValues docValues = DocValues.getSortedSet(context.reader, "my_field");
long x = LegacyNumericUtils.prefixCodedToLong(docValues.lookupOrd(b))
I am in the process of upgrading from Solr 5.5 to 6.2, so I changed NumericUtils to LegacyNumericUtils.
Basically, I am taking the BytesRef from a field and extracting the long from it.
However, LegacyNumericUtils is the deprecated form of NumericUtils. It says that I should use the PointValues class instead. However, unless I am missing something, it does not seem to support converting BytesRef to long/int/etc.
Is there a better method to do this? I would rather not deprecated code.
-Kevin
Re: Convert BytesRef to long in Solr 6.2
Posted by Chris Hostetter <ho...@fucit.org>.
: I am in the process of upgrading from Solr 5.5 to 6.2, so I changed NumericUtils to LegacyNumericUtils.
...
: However, LegacyNumericUtils is the deprecated form of NumericUtils. It
: says that I should use the PointValues class instead. However, unless I
: am missing something, it does not seem to support converting BytesRef to
: long/int/etc.
correct -- that's a general lucene level deprecation warning encouraging
existing applicatons using NumericUtils to change to use PointsField
at index time -- Solr does not yet support points field, so switching your
code to use LegacyNumericUtils is appropriate at this point.
-Hoss
http://www.lucidworks.com/