From 36183af22c6d24326721f76e8bdc80b7722e63b9 Mon Sep 17 00:00:00 2001 From: kimchy Date: Mon, 15 Nov 2010 17:15:24 +0200 Subject: [PATCH] automatically use match_all query when executing a _all:* query string --- .../java/org/apache/lucene/queryParser/MapperQueryParser.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/elasticsearch/src/main/java/org/apache/lucene/queryParser/MapperQueryParser.java b/modules/elasticsearch/src/main/java/org/apache/lucene/queryParser/MapperQueryParser.java index 20dca8cad19..8ee202f5487 100644 --- a/modules/elasticsearch/src/main/java/org/apache/lucene/queryParser/MapperQueryParser.java +++ b/modules/elasticsearch/src/main/java/org/apache/lucene/queryParser/MapperQueryParser.java @@ -26,6 +26,7 @@ import org.apache.lucene.search.Query; import org.elasticsearch.common.collect.ImmutableMap; import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.common.lucene.search.Queries; +import org.elasticsearch.index.mapper.AllFieldMapper; import org.elasticsearch.index.mapper.FieldMapper; import org.elasticsearch.index.mapper.FieldMappers; import org.elasticsearch.index.mapper.MapperService; @@ -177,6 +178,9 @@ public class MapperQueryParser extends QueryParser { } @Override protected Query getWildcardQuery(String field, String termStr) throws ParseException { + if (AllFieldMapper.NAME.equals(field) && termStr.equals("*")) { + return newMatchAllDocsQuery(); + } String indexedNameField = field; currentMapper = null; if (parseContext.mapperService() != null) {