Search: Empty facets element causes search failures, closes #938.

This commit is contained in:
kimchy 2011-05-17 16:15:45 +03:00
parent af222dc75c
commit cc0a6ed690
2 changed files with 4 additions and 1 deletions

View File

@ -59,7 +59,7 @@ public class FacetPhase implements SearchPhase {
}
@Override public void execute(SearchContext context) throws ElasticSearchException {
if (context.facets() == null) {
if (context.facets() == null || context.facets().facetCollectors() == null) {
return;
}
if (context.queryResult().facets() != null) {

View File

@ -78,6 +78,9 @@ public class ContextIndexSearcher extends ExtendedIndexSearcher {
}
public List<Collector> removeCollectors(String scope) {
if (scopeCollectors == null) {
return null;
}
return scopeCollectors.remove(scope);
}