lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cpoersc...@apache.org
Subject lucene-solr:branch_5x: LUCENE-7263: Make queryparser/xml/CoreParser's SpanQueryBuilderFactory accessible to deriving classes. (Daniel Collins via Christine Poerschke)
Date Tue, 03 May 2016 10:43:00 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_5x 71d915678 -> 8835a45fe


LUCENE-7263: Make queryparser/xml/CoreParser's SpanQueryBuilderFactory accessible to deriving
classes. (Daniel Collins via Christine Poerschke)


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/8835a45f
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/8835a45f
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/8835a45f

Branch: refs/heads/branch_5x
Commit: 8835a45fef8f425feb1af741f87aa9cff13dea91
Parents: 71d9156
Author: Christine Poerschke <cpoerschke@apache.org>
Authored: Tue May 3 10:05:02 2016 +0100
Committer: Christine Poerschke <cpoerschke@apache.org>
Committed: Tue May 3 11:17:49 2016 +0100

----------------------------------------------------------------------
 .../lucene/queryparser/xml/CoreParser.java      | 32 ++++++++++++--------
 1 file changed, 19 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8835a45f/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java
----------------------------------------------------------------------
diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java
b/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java
index b03fb6b..3553eb3 100644
--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java
+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java
@@ -37,6 +37,8 @@ public class CoreParser implements QueryBuilder {
   protected QueryParser parser;
   protected QueryBuilderFactory queryFactory;
   protected FilterBuilderFactory filterFactory;
+  final protected SpanQueryBuilderFactory spanFactory;
+
   //Controls the max size of the LRU cache used for QueryFilter objects parsed.
   public static int maxNumCachedFilters = 20;
 
@@ -68,6 +70,8 @@ public class CoreParser implements QueryBuilder {
     filterFactory.addBuilder("NumericRangeFilter", new NumericRangeFilterBuilder());
 
     queryFactory = new QueryBuilderFactory();
+    spanFactory = new SpanQueryBuilderFactory();
+
     queryFactory.addBuilder("TermQuery", new TermQueryBuilder());
     queryFactory.addBuilder("TermsQuery", new TermsQueryBuilder(analyzer));
     queryFactory.addBuilder("MatchAllDocsQuery", new MatchAllDocsQueryBuilder());
@@ -87,34 +91,32 @@ public class CoreParser implements QueryBuilder {
         filterFactory, maxNumCachedFilters));
 
 
-    SpanQueryBuilderFactory sqof = new SpanQueryBuilderFactory();
-
-    SpanNearBuilder snb = new SpanNearBuilder(sqof);
-    sqof.addBuilder("SpanNear", snb);
+    SpanNearBuilder snb = new SpanNearBuilder(spanFactory);
+    spanFactory.addBuilder("SpanNear", snb);
     queryFactory.addBuilder("SpanNear", snb);
 
     BoostingTermBuilder btb = new BoostingTermBuilder();
-    sqof.addBuilder("BoostingTermQuery", btb);
+    spanFactory.addBuilder("BoostingTermQuery", btb);
     queryFactory.addBuilder("BoostingTermQuery", btb);
 
     SpanTermBuilder snt = new SpanTermBuilder();
-    sqof.addBuilder("SpanTerm", snt);
+    spanFactory.addBuilder("SpanTerm", snt);
     queryFactory.addBuilder("SpanTerm", snt);
 
-    SpanOrBuilder sot = new SpanOrBuilder(sqof);
-    sqof.addBuilder("SpanOr", sot);
+    SpanOrBuilder sot = new SpanOrBuilder(spanFactory);
+    spanFactory.addBuilder("SpanOr", sot);
     queryFactory.addBuilder("SpanOr", sot);
 
     SpanOrTermsBuilder sots = new SpanOrTermsBuilder(analyzer);
-    sqof.addBuilder("SpanOrTerms", sots);
+    spanFactory.addBuilder("SpanOrTerms", sots);
     queryFactory.addBuilder("SpanOrTerms", sots);
 
-    SpanFirstBuilder sft = new SpanFirstBuilder(sqof);
-    sqof.addBuilder("SpanFirst", sft);
+    SpanFirstBuilder sft = new SpanFirstBuilder(spanFactory);
+    spanFactory.addBuilder("SpanFirst", sft);
     queryFactory.addBuilder("SpanFirst", sft);
 
-    SpanNotBuilder snot = new SpanNotBuilder(sqof);
-    sqof.addBuilder("SpanNot", snot);
+    SpanNotBuilder snot = new SpanNotBuilder(spanFactory);
+    spanFactory.addBuilder("SpanNot", snot);
     queryFactory.addBuilder("SpanNot", snot);
   }
 
@@ -130,6 +132,10 @@ public class CoreParser implements QueryBuilder {
     filterFactory.addBuilder(nodeName, builder);
   }
 
+  public void addSpanBuilder(String nodeName, SpanQueryBuilder builder) {
+    spanFactory.addBuilder(nodeName, builder);
+  }
+
   static Document parseXML(InputStream pXmlFile) throws ParserException {
     DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
     DocumentBuilder db = null;


Mime
View raw message