lucene4: check liveDocs and acceptedDocs for null before trying to call get() on them
This commit is contained in:
parent
3f3a95668b
commit
7aac88cf5c
|
@ -93,7 +93,7 @@ public class NotDeletedFilter extends Filter {
|
|||
|
||||
@Override
|
||||
protected boolean match(int doc) {
|
||||
return liveDocs.get(doc);
|
||||
return liveDocs == null || liveDocs.get(doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ public abstract class HasChildFilter extends Filter implements ScopePhase.Collec
|
|||
}
|
||||
|
||||
public boolean get(int doc) {
|
||||
return acceptDocs.get(doc) && parents.contains(typeCache.idByDoc(doc));
|
||||
return (acceptDocs == null || acceptDocs.get(doc)) && parents.contains(typeCache.idByDoc(doc));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ public abstract class HasParentFilter extends Filter implements ScopePhase.Colle
|
|||
}
|
||||
|
||||
public boolean get(int doc) {
|
||||
return acceptDocs.get(doc) && parents.contains(idReaderTypeCache.parentIdByDoc(doc));
|
||||
return (acceptDocs == null || acceptDocs.get(doc)) && parents.contains(idReaderTypeCache.parentIdByDoc(doc));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ public abstract class HasParentFilter extends Filter implements ScopePhase.Colle
|
|||
}
|
||||
|
||||
public boolean get(int doc) {
|
||||
if (!acceptDocs.get(doc) || doc == -1) {
|
||||
if ((acceptDocs != null && !acceptDocs.get(doc)) || doc == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,8 @@ public class TopChildrenQuery extends Query implements ScopePhase.TopDocsPhase {
|
|||
for (AtomicReaderContext atomicReaderContext : context.searcher().getIndexReader().leaves()) {
|
||||
AtomicReader indexReader = atomicReaderContext.reader();
|
||||
int parentDocId = context.idCache().reader(indexReader).docById(parentType, parentId);
|
||||
if (parentDocId != -1 && indexReader.getLiveDocs().get(parentDocId)) {
|
||||
Bits liveDocs = indexReader.getLiveDocs();
|
||||
if (parentDocId != -1 && (liveDocs == null || liveDocs.get(parentDocId))) {
|
||||
// we found a match, add it and break
|
||||
|
||||
TIntObjectHashMap<ParentDoc> readerParentDocs = parentDocsPerReader.get(indexReader.getCoreCacheKey());
|
||||
|
|
Loading…
Reference in New Issue