Added support for MatchAllDocs

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@388296 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Harwood 2006-03-23 23:30:33 +00:00
parent 49de97e3b0
commit fa0516f6ee
3 changed files with 18 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import org.apache.lucene.search.Query;
import org.apache.lucene.xmlparser.builders.BooleanQueryBuilder;
import org.apache.lucene.xmlparser.builders.ConstantScoreQueryBuilder;
import org.apache.lucene.xmlparser.builders.FilteredQueryBuilder;
import org.apache.lucene.xmlparser.builders.MatchAllDocsQueryBuilder;
import org.apache.lucene.xmlparser.builders.RangeFilterBuilder;
import org.apache.lucene.xmlparser.builders.SpanFirstBuilder;
import org.apache.lucene.xmlparser.builders.SpanNearBuilder;
@ -47,6 +48,7 @@ public class CoreParser implements QueryBuilder
queryFactory = new QueryBuilderFactory();
queryFactory.addBuilder("TermQuery",new TermQueryBuilder());
queryFactory.addBuilder("MatchAllDocsQuery",new MatchAllDocsQueryBuilder());
queryFactory.addBuilder("BooleanQuery",new BooleanQueryBuilder(queryFactory));
queryFactory.addBuilder("UserQuery",new UserInputQueryBuilder(parser));
queryFactory.addBuilder("FilteredQuery",new FilteredQueryBuilder(filterFactory,queryFactory));

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<FilteredQuery>
<Query>
<MatchAllDocsQuery/>
</Query>
<Filter>
<RangeFilter fieldName="date" lowerTerm="19870409" upperTerm="19870412"/>
</Filter>
</FilteredQuery>

View File

@ -135,6 +135,11 @@ public class TestParser extends TestCase {
Query q=parse("ConstantScoreQuery.xml");
dumpResults("ConstantScoreQuery",q, 5);
}
public void testMatchAllDocsPlusFilterXML() throws ParserException, IOException
{
Query q=parse("MatchAllDocsQuery.xml");
dumpResults("MatchAllDocsQuery with range filter", q, 5);
}