From fa0516f6eee648ddea8da96d4af6d28be04bea9c Mon Sep 17 00:00:00 2001 From: Mark Harwood Date: Thu, 23 Mar 2006 23:30:33 +0000 Subject: [PATCH] Added support for MatchAllDocs git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@388296 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/lucene/xmlparser/CoreParser.java | 2 ++ .../org/apache/lucene/xmlparser/MatchAllDocsQuery.xml | 11 +++++++++++ .../test/org/apache/lucene/xmlparser/TestParser.java | 5 +++++ 3 files changed, 18 insertions(+) create mode 100644 contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/MatchAllDocsQuery.xml diff --git a/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/CoreParser.java b/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/CoreParser.java index e971bd38da4..9faaa37b5f4 100644 --- a/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/CoreParser.java +++ b/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/CoreParser.java @@ -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)); diff --git a/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/MatchAllDocsQuery.xml b/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/MatchAllDocsQuery.xml new file mode 100644 index 00000000000..cd56de450cc --- /dev/null +++ b/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/MatchAllDocsQuery.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java b/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java index 3d4d6fb9b15..ba660013cbb 100644 --- a/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java +++ b/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java @@ -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); + }