You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by cp...@apache.org on 2015/12/07 19:10:47 UTC
svn commit: r1718434 - in /lucene/dev/branches/branch_5x/lucene: ./
queryparser/ queryparser/src/test/org/apache/lucene/queryparser/xml/
Author: cpoerschke
Date: Mon Dec 7 18:10:47 2015
New Revision: 1718434
URL: http://svn.apache.org/viewvc?rev=1718434&view=rev
Log:
LUCENE-6907: make TestParser extendable, rename lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/NumericRangeQueryQuery.xml to NumericRangeQuery.xml (merge in revision 1718427 from trunk)
Added:
lucene/dev/branches/branch_5x/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/NumericRangeQuery.xml
- copied unchanged from r1718427, lucene/dev/branches/branch_5x/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/NumericRangeQueryQuery.xml
Removed:
lucene/dev/branches/branch_5x/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/NumericRangeQueryQuery.xml
Modified:
lucene/dev/branches/branch_5x/lucene/ (props changed)
lucene/dev/branches/branch_5x/lucene/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_5x/lucene/queryparser/ (props changed)
lucene/dev/branches/branch_5x/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestParser.java
Modified: lucene/dev/branches/branch_5x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/CHANGES.txt?rev=1718434&r1=1718433&r2=1718434&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/lucene/CHANGES.txt Mon Dec 7 18:10:47 2015
@@ -44,6 +44,10 @@ Other
* LUCENE-6923: Fix RamUsageEstimator to access private fields inside
AccessController block for computing size. (Robert Muir)
+* LUCENE-6907: make TestParser extendable, rename test/.../xml/
+ NumericRangeQueryQuery.xml to NumericRangeQuery.xml
+ (Christine Poerschke)
+
======================= Lucene 5.4.0 =======================
New Features
Modified: lucene/dev/branches/branch_5x/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestParser.java?rev=1718434&r1=1718433&r2=1718434&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestParser.java (original)
+++ lucene/dev/branches/branch_5x/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestParser.java Mon Dec 7 18:10:47 2015
@@ -49,7 +49,8 @@ import java.util.List;
public class TestParser extends LuceneTestCase {
- private static CoreParser builder;
+ private static Analyzer analyzer;
+ private static CoreParser coreParser;
private static Directory dir;
private static IndexReader reader;
private static IndexSearcher searcher;
@@ -57,9 +58,9 @@ public class TestParser extends LuceneTe
@BeforeClass
public static void beforeClass() throws Exception {
// TODO: rewrite test (this needs to set QueryParser.enablePositionIncrements, too, for work with CURRENT):
- Analyzer analyzer = new MockAnalyzer(random(), MockTokenizer.WHITESPACE, true, MockTokenFilter.ENGLISH_STOPSET);
+ analyzer = new MockAnalyzer(random(), MockTokenizer.WHITESPACE, true, MockTokenFilter.ENGLISH_STOPSET);
//initialize the parser
- builder = new CorePlusExtensionsParser("contents", analyzer);
+ coreParser = new CorePlusExtensionsParser("contents", analyzer);
BufferedReader d = new BufferedReader(new InputStreamReader(
TestParser.class.getResourceAsStream("reuters21578.txt"), StandardCharsets.US_ASCII));
@@ -91,7 +92,8 @@ public class TestParser extends LuceneTe
reader = null;
searcher = null;
dir = null;
- builder = null;
+ coreParser = null;
+ analyzer = null;
}
public void testSimpleXML() throws ParserException, IOException {
@@ -213,16 +215,24 @@ public class TestParser extends LuceneTe
dumpResults("NumericRangeFilter", q, 5);
}
- public void testNumericRangeQueryQueryXML() throws ParserException, IOException {
- Query q = parse("NumericRangeQueryQuery.xml");
+ public void testNumericRangeQueryXML() throws ParserException, IOException {
+ Query q = parse("NumericRangeQuery.xml");
dumpResults("NumericRangeQuery", q, 5);
}
//================= Helper methods ===================================
+ protected Analyzer analyzer() {
+ return analyzer;
+ }
+
+ protected CoreParser coreParser() {
+ return coreParser;
+ }
+
private Query parse(String xmlFileName) throws ParserException, IOException {
InputStream xmlStream = TestParser.class.getResourceAsStream(xmlFileName);
- Query result = builder.parse(xmlStream);
+ Query result = coreParser().parse(xmlStream);
xmlStream.close();
return result;
}