Vesa Pirila created LUCENE-7851:
-----------------------------------

             Summary: Lucene54DocValuesProducer#getSortedSetTable lookupTerm 
does not honor lookupTerm
                 Key: LUCENE-7851
                 URL: https://issues.apache.org/jira/browse/LUCENE-7851
             Project: Lucene - Core
          Issue Type: Bug
            Reporter: Vesa Pirila


I'm having a problem with the lookupTerm method of the anonymous 
RandomAccessOrds class returned by 
Lucene54DocValuesProducer#getSortedSetTable(). It does not seem to honor 
setDocument. It returns the same ord every time regardless of my calling 
setDocument with different arguments.

To reproduce:
I have two documents with a multi-valued string field "strfield". Both have a 
single value "a". I have a custom class that extends FieldCacheSource. This is 
obviously just a dummy, but it's the simplest way I know to reproduce the 
problem.

public class MyValueSource extends FieldCacheSource {
  public MyValueSource(String field) {
    super(field);
  }

  @Override
  public FunctionValues getValues(Map map, LeafReaderContext readerContext) 
throws IOException {
    SortedSetDocValues dvs = DocValues.getSortedSet(readerContext.reader(), 
FieldNames.PARENTS_DATES);
    dvs.setDocument(0);
    long zeroOrd = dvs.lookupTerm(new BytesRef("a"));
    dvs.setDocument(1);
    long oneOrd = dvs.lookupTerm(new BytesRef("a"));
    assert(zeroOrd != oneOrd); // FAILS. The same ord is always returned.

    return new LongDocValues(this) {
      @Override
      public long longVal(int doc) {
        return 0;
      }
    };
  }
}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to