lucene-commits mailing list archives

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


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/72ce1fae
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/72ce1fae
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/72ce1fae

Branch: refs/heads/branch_6x
Commit: 72ce1faecd88870e41f34e48d82ac9369e7b379e
Parents: 0a00375
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 10:49:08 2016 +0100

----------------------------------------------------------------------
 lucene/CHANGES.txt                              |  3 ++
 .../lucene/queryparser/xml/CoreParser.java      | 31 ++++++++++++--------
 2 files changed, 21 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/72ce1fae/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 2735ee8..a3a4fff 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -120,6 +120,9 @@ Other
 * LUCENE-7210: Make TestCore*Parser's analyzer choice override-able
   (Christine Poerschke, Daniel Collins)
 
+* LUCENE-7263: Make queryparser/xml/CoreParser's SpanQueryBuilderFactory
+  accessible to deriving classes. (Daniel Collins via Christine Poerschke)
+
 ======================= Lucene 6.0.0 =======================
 
 System Requirements

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/72ce1fae/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 0c5cf84..2dd0097 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
@@ -36,6 +36,7 @@ public class CoreParser implements QueryBuilder {
   protected Analyzer analyzer;
   protected QueryParser parser;
   protected QueryBuilderFactory queryFactory;
+  final protected SpanQueryBuilderFactory spanFactory;
 
 
   /**
@@ -62,6 +63,8 @@ public class CoreParser implements QueryBuilder {
     this.parser = parser;
 
     queryFactory = new QueryBuilderFactory();
+    spanFactory = new SpanQueryBuilderFactory();
+
     queryFactory.addBuilder("TermQuery", new TermQueryBuilder());
     queryFactory.addBuilder("TermsQuery", new TermsQueryBuilder(analyzer));
     queryFactory.addBuilder("MatchAllDocsQuery", new MatchAllDocsQueryBuilder());
@@ -77,34 +80,32 @@ public class CoreParser implements QueryBuilder {
     }
     queryFactory.addBuilder("ConstantScoreQuery", new ConstantScoreQueryBuilder(queryFactory));
 
-    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);
   }
 
@@ -116,6 +117,10 @@ public class CoreParser implements QueryBuilder {
     queryFactory.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