lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [34/58] lucenenet git commit: QueryParser.Flexible refactor: Made QueryTreeBuilder abstract class so the static QUERY_TREE_BUILDER_TAGID can be used without referencing the QueryTreeBuilder<T>'s generic closing type
Date Tue, 06 Dec 2016 15:12:09 GMT
QueryParser.Flexible refactor: Made QueryTreeBuilder abstract class so the static QUERY_TREE_BUILDER_TAGID
can be used without referencing the QueryTreeBuilder<T>'s generic closing type


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/330d0277
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/330d0277
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/330d0277

Branch: refs/heads/master
Commit: 330d02773acddaa29b4da0d96aded57376086946
Parents: c5c54ab
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Mon Dec 5 19:43:30 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Mon Dec 5 19:43:30 2016 +0700

----------------------------------------------------------------------
 .../Flexible/Core/Builders/QueryTreeBuilder.cs  | 21 +++++++++++++-------
 .../Standard/Builders/AnyQueryNodeBuilder.cs    |  2 +-
 .../Builders/BooleanQueryNodeBuilder.cs         |  2 +-
 .../Standard/Builders/BoostQueryNodeBuilder.cs  |  2 +-
 .../Standard/Builders/GroupQueryNodeBuilder.cs  |  2 +-
 .../Builders/ModifierQueryNodeBuilder.cs        |  2 +-
 .../Builders/MultiPhraseQueryNodeBuilder.cs     |  2 +-
 .../Standard/Builders/PhraseQueryNodeBuilder.cs |  2 +-
 .../Standard/Builders/SlopQueryNodeBuilder.cs   |  2 +-
 .../Builders/StandardBooleanQueryNodeBuilder.cs |  2 +-
 .../Flexible/Spans/SpanOrQueryNodeBuilder.cs    |  2 +-
 11 files changed, 24 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/330d0277/src/Lucene.Net.QueryParser/Flexible/Core/Builders/QueryTreeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Core/Builders/QueryTreeBuilder.cs b/src/Lucene.Net.QueryParser/Flexible/Core/Builders/QueryTreeBuilder.cs
index e622c25..65f3798 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Core/Builders/QueryTreeBuilder.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Core/Builders/QueryTreeBuilder.cs
@@ -51,14 +51,8 @@ namespace Lucene.Net.QueryParsers.Flexible.Core.Builders
     /// </para>
     /// <seealso cref="IQueryBuilder"/>
     /// </summary>
-    public class QueryTreeBuilder<TQuery> : IQueryBuilder<TQuery>
+    public class QueryTreeBuilder<TQuery> : QueryTreeBuilder, IQueryBuilder<TQuery>
     {
-        /**
-   * This tag is used to tag the nodes in a query tree with the built objects
-   * produced from their own associated builder.
-   */
-        public static readonly string QUERY_TREE_BUILDER_TAGID = typeof(QueryTreeBuilder<TQuery>).Name;
-
         private IDictionary<Type, IQueryBuilder<TQuery>> queryNodeBuilders;
 
         private IDictionary<string, IQueryBuilder<TQuery>> fieldNameBuilders;
@@ -224,4 +218,17 @@ namespace Lucene.Net.QueryParsers.Flexible.Core.Builders
             return (TQuery)queryNode.GetTag(QUERY_TREE_BUILDER_TAGID);
         }
     }
+
+    /// <summary>
+    /// LUCENENET specific class for accessing static members of <see cref="QueryTreeBuilder{TQuery}"/>
+    /// without referencing its generic closing type.
+    /// </summary>
+    public abstract class QueryTreeBuilder
+    {
+        /// <summary>
+        /// This tag is used to tag the nodes in a query tree with the built objects
+        /// produced from their own associated builder.
+        /// </summary>
+        public static readonly string QUERY_TREE_BUILDER_TAGID = typeof(QueryTreeBuilder).Name;
+    }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/330d0277/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/AnyQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/AnyQueryNodeBuilder.cs
b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/AnyQueryNodeBuilder.cs
index 56fbab5..e3c09ab 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/AnyQueryNodeBuilder.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/AnyQueryNodeBuilder.cs
@@ -47,7 +47,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders
             {
                 foreach (IQueryNode child in children)
                 {
-                    object obj = child.GetTag(QueryTreeBuilder<Query>.QUERY_TREE_BUILDER_TAGID);
+                    object obj = child.GetTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
 
                     if (obj != null)
                     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/330d0277/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/BooleanQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/BooleanQueryNodeBuilder.cs
b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/BooleanQueryNodeBuilder.cs
index 9fc0e34..8f29be5 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/BooleanQueryNodeBuilder.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/BooleanQueryNodeBuilder.cs
@@ -54,7 +54,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders
             {
                 foreach (IQueryNode child in children)
                 {
-                    object obj = child.GetTag(QueryTreeBuilder<Query>.QUERY_TREE_BUILDER_TAGID);
+                    object obj = child.GetTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
 
                     if (obj != null)
                     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/330d0277/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/BoostQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/BoostQueryNodeBuilder.cs
b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/BoostQueryNodeBuilder.cs
index 51d9cdb..afa01ab 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/BoostQueryNodeBuilder.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/BoostQueryNodeBuilder.cs
@@ -45,7 +45,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders
             }
 
             Query query = (Query)child
-                .GetTag(QueryTreeBuilder<Query>.QUERY_TREE_BUILDER_TAGID);
+                .GetTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
             query.Boost = boostNode.Value;
 
             return query;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/330d0277/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/GroupQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/GroupQueryNodeBuilder.cs
b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/GroupQueryNodeBuilder.cs
index 66546e1..69490b6 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/GroupQueryNodeBuilder.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/GroupQueryNodeBuilder.cs
@@ -38,7 +38,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders
             GroupQueryNode groupNode = (GroupQueryNode)queryNode;
 
             return (Query)(groupNode).GetChild().GetTag(
-                QueryTreeBuilder<Query>.QUERY_TREE_BUILDER_TAGID);
+                QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/330d0277/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/ModifierQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/ModifierQueryNodeBuilder.cs
b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/ModifierQueryNodeBuilder.cs
index 4eb6941..f7f9572 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/ModifierQueryNodeBuilder.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/ModifierQueryNodeBuilder.cs
@@ -38,7 +38,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders
             ModifierQueryNode modifierNode = (ModifierQueryNode)queryNode;
 
             return (Query)(modifierNode).GetChild().GetTag(
-                QueryTreeBuilder<Query>.QUERY_TREE_BUILDER_TAGID);
+                QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/330d0277/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/MultiPhraseQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/MultiPhraseQueryNodeBuilder.cs
b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/MultiPhraseQueryNodeBuilder.cs
index 0931211..6eb883c 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/MultiPhraseQueryNodeBuilder.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/MultiPhraseQueryNodeBuilder.cs
@@ -51,7 +51,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders
                 {
                     FieldQueryNode termNode = (FieldQueryNode)child;
                     TermQuery termQuery = (TermQuery)termNode
-                        .GetTag(QueryTreeBuilder<Query>.QUERY_TREE_BUILDER_TAGID);
+                        .GetTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
 
                     List<Term> termList;
                     if (!positionTermMap.TryGetValue(termNode.PositionIncrement, out termList)
|| termList == null)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/330d0277/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/PhraseQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/PhraseQueryNodeBuilder.cs
b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/PhraseQueryNodeBuilder.cs
index 295c6f6..79f3dba 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/PhraseQueryNodeBuilder.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/PhraseQueryNodeBuilder.cs
@@ -46,7 +46,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders
                 foreach (IQueryNode child in children)
                 {
                     TermQuery termQuery = (TermQuery)child
-                        .GetTag(QueryTreeBuilder<Query>.QUERY_TREE_BUILDER_TAGID);
+                        .GetTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
                     FieldQueryNode termNode = (FieldQueryNode)child;
 
                     phraseQuery.Add(termQuery.Term, termNode.PositionIncrement);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/330d0277/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/SlopQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/SlopQueryNodeBuilder.cs
b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/SlopQueryNodeBuilder.cs
index 2a32d66..bf3156e 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/SlopQueryNodeBuilder.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/SlopQueryNodeBuilder.cs
@@ -39,7 +39,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders
             SlopQueryNode phraseSlopNode = (SlopQueryNode)queryNode;
 
             Query query = (Query)phraseSlopNode.GetChild().GetTag(
-                QueryTreeBuilder<Query>.QUERY_TREE_BUILDER_TAGID);
+                QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
 
             if (query is PhraseQuery)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/330d0277/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/StandardBooleanQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/StandardBooleanQueryNodeBuilder.cs
b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/StandardBooleanQueryNodeBuilder.cs
index b8d92d0..428a75e 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/StandardBooleanQueryNodeBuilder.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/StandardBooleanQueryNodeBuilder.cs
@@ -53,7 +53,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders
             {
                 foreach (IQueryNode child in children)
                 {
-                    object obj = child.GetTag(QueryTreeBuilder<Query>.QUERY_TREE_BUILDER_TAGID);
+                    object obj = child.GetTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
 
                     if (obj != null)
                     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/330d0277/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpanOrQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpanOrQueryNodeBuilder.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpanOrQueryNodeBuilder.cs
index 518bbd0..fbc5ea7 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpanOrQueryNodeBuilder.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpanOrQueryNodeBuilder.cs
@@ -44,7 +44,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
             foreach (IQueryNode child in children)
             {
                 spanQueries[i++] = (SpanQuery)child
-                    .GetTag(QueryTreeBuilder<Query>.QUERY_TREE_BUILDER_TAGID);
+                    .GetTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
             }
 
             return new SpanOrQuery(spanQueries);


Mime
View raw message