Skip to content

Commit

Permalink
Parent Child: complex parent child mapping (>2 hierarchy) might fail, c…
Browse files Browse the repository at this point in the history
…loses #1039.
  • Loading branch information
kimchy committed Jun 16, 2011
1 parent f5fbe0d commit 2e64edd
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -149,7 +149,6 @@ public class SimpleIdCache extends AbstractIndexComponent implements IdCache, In

Map<String, TypeBuilder> readerBuilder = builders.get(reader.getCoreCacheKey());

int t = 1; // current term number (0 indicated null value)
String field = StringHelper.intern(ParentFieldMapper.NAME);
TermDocs termDocs = reader.termDocs();
TermEnum termEnum = reader.terms(new Term(field));
Expand Down Expand Up @@ -178,11 +177,11 @@ public class SimpleIdCache extends AbstractIndexComponent implements IdCache, In
typeBuilder.parentIdsValues.add(idAsBytes);
added = true;
}
typeBuilder.parentIdsOrdinals[termDocs.doc()] = t;
typeBuilder.parentIdsOrdinals[termDocs.doc()] = typeBuilder.t;
}
}
if (added) {
t++;
typeBuilder.t++;
}
} while (termEnum.next());
} finally {
Expand Down Expand Up @@ -241,6 +240,7 @@ static class TypeBuilder {
final ExtTObjectIntHasMap<BytesWrap> idToDoc = new ExtTObjectIntHasMap<BytesWrap>(Constants.DEFAULT_CAPACITY, Constants.DEFAULT_LOAD_FACTOR, -1);
final ArrayList<BytesWrap> parentIdsValues = new ArrayList<BytesWrap>();
final int[] parentIdsOrdinals;
int t = 1; // current term number (0 indicated null value)

TypeBuilder(IndexReader reader) {
parentIdsOrdinals = new int[reader.maxDoc()];
Expand Down

0 comments on commit 2e64edd

Please sign in to comment.