Continuation, found a bug but I'm not sure whether it's in Lucene or
Lucene's Javadoc.

In MultiFields:

      public Iterator<String> iterator() {
        Iterator<String> subIterators[] = new Iterator[subs.length];
        for(int i=0;i<subs.length;i++) {
          subIterators[i] = subs[i].iterator();
        return new MergedIterator<>(subIterators);

MergedIterator says in the Javadoc:

    "The behavior is undefined if the iterators are not actually sorted."

And indeed, the iterators are _not_ actually sorted. So I look at
where they come from, Fields#iterator(), which is documented fairly

    "Returns an iterator that will step through all fields names.
This will not return null."

Which doesn't say anything about the names being in order. So I assume
that either:

  (a) Fields#iterator() is actually supposed to be sorted and the
documentation should specify it but doesn't, or

  (b) Fields#iterator() is not supposed to be sorted, but either
MultiFields#iterator() or MergedIterator is supposed to be handling
this better.

Either way, I think it's a bug in Lucene. But since I don't know which
direction it's in, and I don't have a reproducible test case I can
just hand over, I can't easily file it. :/


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

Reply via email to