lucenenet-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Rojo <>
Subject 3.0.3 Migration BinaryDocValues sample usage
Date Fri, 13 Apr 2018 14:09:58 GMT
Hi community,

Im looking at the migration guide and in regard to getting the Values from the field cache
it says:
If you had code like this before:
String[] values = FieldCache.DEFAULT.getStrings(reader, field);
String aValue = values[docID];
you can do this instead:
DocTerms values = FieldCache.DEFAULT.getTerms(reader, field);
BytesRef term = new BytesRef();
String aValue = values.getTerm(docID, term).utf8ToString();

For some reason we don't have DocTerms in Lucene.Net but we do have BinaryDocValues instead.

So I need guidance as to how to implement the Get method in the BinaryDocValues class specially
because I don't know what I'm supposed to do with the docID parameter

Previously I had an array of strings and I would just pass in the docId and get the string
but here how do I use the BinaryDocValue? This is how I get the BinaryDocValue

        Private currentReaderValues As ReaderValues

        Public Overrides Function SetNextReader(context As AtomicReaderContext) As FieldComparer
            currentReaderValues = FieldCache.DEFAULT.GetTerms(context.AtomicReader, field,
            Return Me
        End Function

    Public Class ReaderValues
        Inherits BinaryDocValues

        Public Overrides Sub [Get](docID As Integer, result As BytesRef)
              'TODO How to deal with this do I just return the result.ToUtf8String()?
        End Sub
    End Class

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message