Now really fix eager fielddata loading.

Relates to #5557
This commit is contained in:
Martijn van Groningen 2014-03-27 13:52:57 +07:00
parent 5a0c1eb195
commit 22b13f5449
1 changed files with 12 additions and 5 deletions

View File

@ -767,17 +767,24 @@ public class SearchService extends AbstractLifecycleComponent<SearchService> {
if (fieldDataType == null) { if (fieldDataType == null) {
continue; continue;
} }
final String indexName = fieldMapper.names().indexName();
if (fieldMapper instanceof ParentFieldMapper) { if (fieldMapper instanceof ParentFieldMapper) {
ParentFieldMapper parentFieldMapper = (ParentFieldMapper) fieldMapper; ParentFieldMapper parentFieldMapper = (ParentFieldMapper) fieldMapper;
if (parentFieldMapper.active()) { if (!parentFieldMapper.active()) {
warmUp.put(indexName, parentFieldMapper); continue;
}
} else {
if (fieldDataType.getLoading() != Loading.EAGER) {
continue;
}
}
final String indexName = fieldMapper.names().indexName();
if (warmUp.containsKey(indexName)) {
continue;
} }
} else if (fieldDataType.getLoading() != Loading.EAGER && !warmUp.containsKey(indexName)) {
warmUp.put(indexName, fieldMapper); warmUp.put(indexName, fieldMapper);
} }
} }
}
final IndexFieldDataService indexFieldDataService = indexShard.indexFieldDataService(); final IndexFieldDataService indexFieldDataService = indexShard.indexFieldDataService();
final Executor executor = threadPool.executor(executor()); final Executor executor = threadPool.executor(executor());
final CountDownLatch latch = new CountDownLatch(context.newSearcher().reader().leaves().size() * warmUp.size()); final CountDownLatch latch = new CountDownLatch(context.newSearcher().reader().leaves().size() * warmUp.size());