lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shai Erera (JIRA)" <>
Subject [jira] [Commented] (LUCENE-5683) Improve SegmentReader.getXXXDocValues
Date Wed, 21 May 2014 15:06:38 GMT


Shai Erera commented on LUCENE-5683:

I implemented it, many tests fail in CheckIndex on ClassCastException. So this is the current

FieldInfo fi = getDVField(field, DocValuesType.BINARY);
if (fi == null) {
  return null;

Map<String,Object> dvFields = docValuesLocal.get();
BinaryDocValues dvs = (BinaryDocValues) dvFields.get(field);
if (dvs == null) {
  // initialize

And I changed it so that the FieldInfo part is inside the {{if}} (lazily initialize). The
reason for the ClassCastException is that if you previously asked for a NUMERIC field w/ same
name, it got into the map, therefore the code happily tries to case it to a NumericDocValues,
or BinaryDocValues and hits the exception.

So I'm not sure this optimization is right .. but also that it's worth complicating the code
w/ e.g. instanceof checks?

> Improve SegmentReader.getXXXDocValues
> -------------------------------------
>                 Key: LUCENE-5683
>                 URL:
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Shai Erera
>            Assignee: Shai Erera
> Today we do two hash lookups, where in most cases a single one is enough. E.g. SR.getNumericDocValues
initializes the FieldInfo (first lookup in FieldInfos), however if that field was already
initialized, we can simply check dvFields.get(). This can be improved in all getXXXDocValues
as well as getDocsWithField.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message