lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mhern...@apache.org
Subject [13/16] git commit: Some work on Flexible.Standard
Date Sun, 06 Oct 2013 23:48:01 GMT
Some work on Flexible.Standard


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

Branch: refs/heads/branch_4x
Commit: c50db238a2c3bf87db397192dc826e651c3702fe
Parents: f66837d
Author: Paul Irwin <paulirwin@gmail.com>
Authored: Sat Oct 5 16:36:58 2013 -0400
Committer: Paul Irwin <paulirwin@gmail.com>
Committed: Sat Oct 5 16:37:30 2013 -0400

----------------------------------------------------------------------
 .../QueryParsers/Contrib.QueryParsers.csproj    |  12 ++
 .../Standard/Builders/BoostQueryNodeBuilder.cs  |  40 +++++
 .../Standard/Builders/DummyQueryNodeBuilder.cs  |  29 ++++
 .../Standard/Builders/FieldQueryNodeBuilder.cs  |  32 ++++
 .../Standard/Builders/FuzzyQueryNodeBuilder.cs  |  35 ++++
 .../Standard/Builders/GroupQueryNodeBuilder.cs  |  31 ++++
 .../Builders/MatchAllDocsQueryNodeBuilder.cs    |  40 +++++
 .../Builders/MatchNoDocsQueryNodeBuilder.cs     |  41 +++++
 .../Builders/ModifierQueryNodeBuilder.cs        |  31 ++++
 .../Builders/MultiPhraseQueryNodeBuilder.cs     |  66 ++++++++
 .../Standard/Nodes/AbstractRangeQueryNode.cs    | 167 +++++++++++++++++++
 .../Standard/Nodes/BooleanModifierNode.cs       |  17 ++
 .../Standard/Nodes/MultiPhraseQueryNode.cs      |  92 ++++++++++
 13 files changed, 633 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c50db238/src/contrib/QueryParsers/Contrib.QueryParsers.csproj
----------------------------------------------------------------------
diff --git a/src/contrib/QueryParsers/Contrib.QueryParsers.csproj b/src/contrib/QueryParsers/Contrib.QueryParsers.csproj
index b69ba58..195d08e 100644
--- a/src/contrib/QueryParsers/Contrib.QueryParsers.csproj
+++ b/src/contrib/QueryParsers/Contrib.QueryParsers.csproj
@@ -111,8 +111,20 @@
     <Compile Include="Flexible\Messages\NLS.cs" />
     <Compile Include="Flexible\Standard\Builders\AnyQueryNodeBuilder.cs" />
     <Compile Include="Flexible\Standard\Builders\BooleanQueryNodeBuilder.cs" />
+    <Compile Include="Flexible\Standard\Builders\BoostQueryNodeBuilder.cs" />
+    <Compile Include="Flexible\Standard\Builders\DummyQueryNodeBuilder.cs" />
+    <Compile Include="Flexible\Standard\Builders\FieldQueryNodeBuilder.cs" />
+    <Compile Include="Flexible\Standard\Builders\FuzzyQueryNodeBuilder.cs" />
+    <Compile Include="Flexible\Standard\Builders\GroupQueryNodeBuilder.cs" />
     <Compile Include="Flexible\Standard\Builders\IStandardQueryBuilder.cs" />
+    <Compile Include="Flexible\Standard\Builders\MatchAllDocsQueryNodeBuilder.cs" />
+    <Compile Include="Flexible\Standard\Builders\MatchNoDocsQueryNodeBuilder.cs" />
+    <Compile Include="Flexible\Standard\Builders\ModifierQueryNodeBuilder.cs" />
+    <Compile Include="Flexible\Standard\Builders\MultiPhraseQueryNodeBuilder.cs" />
     <Compile Include="Flexible\Standard\ICommonQueryParserConfiguration.cs" />
+    <Compile Include="Flexible\Standard\Nodes\AbstractRangeQueryNode.cs" />
+    <Compile Include="Flexible\Standard\Nodes\BooleanModifierNode.cs" />
+    <Compile Include="Flexible\Standard\Nodes\MultiPhraseQueryNode.cs" />
     <Compile Include="Flexible\Standard\Parser\EscapeQuerySyntaxImpl.cs" />
     <Compile Include="Flexible\Standard\Parser\ICharStream.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c50db238/src/contrib/QueryParsers/Flexible/Standard/Builders/BoostQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/contrib/QueryParsers/Flexible/Standard/Builders/BoostQueryNodeBuilder.cs
b/src/contrib/QueryParsers/Flexible/Standard/Builders/BoostQueryNodeBuilder.cs
new file mode 100644
index 0000000..77b6b5f
--- /dev/null
+++ b/src/contrib/QueryParsers/Flexible/Standard/Builders/BoostQueryNodeBuilder.cs
@@ -0,0 +1,40 @@
+using Lucene.Net.QueryParsers.Flexible.Core.Builders;
+using Lucene.Net.QueryParsers.Flexible.Core.Nodes;
+using Lucene.Net.Search;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders
+{
+    public class BoostQueryNodeBuilder : IStandardQueryBuilder
+    {
+        public BoostQueryNodeBuilder()
+        {
+            // empty constructor
+        }
+        
+        public Query Build(IQueryNode queryNode)
+        {
+            BoostQueryNode boostNode = (BoostQueryNode)queryNode;
+            IQueryNode child = boostNode.Child;
+
+            if (child == null)
+            {
+                return null;
+            }
+
+            Query query = (Query)child.GetTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
+            query.Boost = boostNode.Value;
+
+            return query;
+        }
+
+        object IQueryBuilder.Build(IQueryNode queryNode)
+        {
+            return Build(queryNode);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c50db238/src/contrib/QueryParsers/Flexible/Standard/Builders/DummyQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/contrib/QueryParsers/Flexible/Standard/Builders/DummyQueryNodeBuilder.cs
b/src/contrib/QueryParsers/Flexible/Standard/Builders/DummyQueryNodeBuilder.cs
new file mode 100644
index 0000000..230d848
--- /dev/null
+++ b/src/contrib/QueryParsers/Flexible/Standard/Builders/DummyQueryNodeBuilder.cs
@@ -0,0 +1,29 @@
+using Lucene.Net.QueryParsers.Flexible.Core.Builders;
+using Lucene.Net.QueryParsers.Flexible.Core.Nodes;
+using Lucene.Net.Search;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders
+{
+    public class DummyQueryNodeBuilder : IStandardQueryBuilder
+    {
+        public DummyQueryNodeBuilder()
+        {
+            // empty constructor
+        }
+
+        public Query Build(IQueryNode queryNode)
+        {
+            return null;
+        }
+
+        object IQueryBuilder.Build(IQueryNode queryNode)
+        {
+            return Build(queryNode);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c50db238/src/contrib/QueryParsers/Flexible/Standard/Builders/FieldQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/contrib/QueryParsers/Flexible/Standard/Builders/FieldQueryNodeBuilder.cs
b/src/contrib/QueryParsers/Flexible/Standard/Builders/FieldQueryNodeBuilder.cs
new file mode 100644
index 0000000..1a38164
--- /dev/null
+++ b/src/contrib/QueryParsers/Flexible/Standard/Builders/FieldQueryNodeBuilder.cs
@@ -0,0 +1,32 @@
+using Lucene.Net.Index;
+using Lucene.Net.QueryParsers.Flexible.Core.Builders;
+using Lucene.Net.QueryParsers.Flexible.Core.Nodes;
+using Lucene.Net.Search;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders
+{
+    public class FieldQueryNodeBuilder : IStandardQueryBuilder
+    {
+        public FieldQueryNodeBuilder()
+        {
+            // empty constructor
+        }
+
+        public Query Build(IQueryNode queryNode)
+        {
+            FieldQueryNode fieldNode = (FieldQueryNode)queryNode;
+
+            return new TermQuery(new Term(fieldNode.FieldAsString, fieldNode.TextAsString));
+        }
+
+        object IQueryBuilder.Build(IQueryNode queryNode)
+        {
+            return Build(queryNode);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c50db238/src/contrib/QueryParsers/Flexible/Standard/Builders/FuzzyQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/contrib/QueryParsers/Flexible/Standard/Builders/FuzzyQueryNodeBuilder.cs
b/src/contrib/QueryParsers/Flexible/Standard/Builders/FuzzyQueryNodeBuilder.cs
new file mode 100644
index 0000000..9681302
--- /dev/null
+++ b/src/contrib/QueryParsers/Flexible/Standard/Builders/FuzzyQueryNodeBuilder.cs
@@ -0,0 +1,35 @@
+using Lucene.Net.Index;
+using Lucene.Net.QueryParsers.Flexible.Core.Builders;
+using Lucene.Net.QueryParsers.Flexible.Core.Nodes;
+using Lucene.Net.Search;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders
+{
+    public class FuzzyQueryNodeBuilder : IStandardQueryBuilder
+    {
+        public FuzzyQueryNodeBuilder()
+        {
+            // empty constructor
+        }
+
+        public Query Build(IQueryNode queryNode)
+        {
+            FuzzyQueryNode fuzzyNode = (FuzzyQueryNode)queryNode;
+            String text = fuzzyNode.TextAsString;
+
+            int numEdits = FuzzyQuery.FloatToEdits(fuzzyNode.Similarity, text.Length);
+
+            return new FuzzyQuery(new Term(fuzzyNode.FieldAsString, fuzzyNode.TextAsString),
numEdits, fuzzyNode.PrefixLength);
+        }
+
+        object IQueryBuilder.Build(IQueryNode queryNode)
+        {
+            return Build(queryNode);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c50db238/src/contrib/QueryParsers/Flexible/Standard/Builders/GroupQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/contrib/QueryParsers/Flexible/Standard/Builders/GroupQueryNodeBuilder.cs
b/src/contrib/QueryParsers/Flexible/Standard/Builders/GroupQueryNodeBuilder.cs
new file mode 100644
index 0000000..650ccc9
--- /dev/null
+++ b/src/contrib/QueryParsers/Flexible/Standard/Builders/GroupQueryNodeBuilder.cs
@@ -0,0 +1,31 @@
+using Lucene.Net.QueryParsers.Flexible.Core.Builders;
+using Lucene.Net.QueryParsers.Flexible.Core.Nodes;
+using Lucene.Net.Search;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders
+{
+    public class GroupQueryNodeBuilder : IStandardQueryBuilder
+    {
+        public GroupQueryNodeBuilder()
+        {
+            // empty constructor
+        }
+
+        public Query Build(IQueryNode queryNode)
+        {
+            GroupQueryNode groupNode = (GroupQueryNode)queryNode;
+
+            return (Query)(groupNode).Child.GetTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
+        }
+
+        object IQueryBuilder.Build(IQueryNode queryNode)
+        {
+            return Build(queryNode);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c50db238/src/contrib/QueryParsers/Flexible/Standard/Builders/MatchAllDocsQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/contrib/QueryParsers/Flexible/Standard/Builders/MatchAllDocsQueryNodeBuilder.cs
b/src/contrib/QueryParsers/Flexible/Standard/Builders/MatchAllDocsQueryNodeBuilder.cs
new file mode 100644
index 0000000..72d73a8
--- /dev/null
+++ b/src/contrib/QueryParsers/Flexible/Standard/Builders/MatchAllDocsQueryNodeBuilder.cs
@@ -0,0 +1,40 @@
+using Lucene.Net.QueryParsers.Flexible.Core;
+using Lucene.Net.QueryParsers.Flexible.Core.Builders;
+using Lucene.Net.QueryParsers.Flexible.Core.Messages;
+using Lucene.Net.QueryParsers.Flexible.Core.Nodes;
+using Lucene.Net.QueryParsers.Flexible.Messages;
+using Lucene.Net.QueryParsers.Flexible.Standard.Parser;
+using Lucene.Net.Search;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders
+{
+    public class MatchAllDocsQueryNodeBuilder : IStandardQueryBuilder
+    {
+        public MatchAllDocsQueryNodeBuilder()
+        {
+            // empty constructor
+        }
+
+        public Query Build(IQueryNode queryNode)
+        {
+            // validates node
+            if (!(queryNode is MatchAllDocsQueryNode))
+            {
+                throw new QueryNodeException(new Message(QueryParserMessages.LUCENE_QUERY_CONVERSION_ERROR,

+                    queryNode.ToQueryString(new EscapeQuerySyntaxImpl()), queryNode.GetType().FullName));
+            }
+
+            return new MatchAllDocsQuery();
+        }
+
+        object IQueryBuilder.Build(IQueryNode queryNode)
+        {
+            return Build(queryNode);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c50db238/src/contrib/QueryParsers/Flexible/Standard/Builders/MatchNoDocsQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/contrib/QueryParsers/Flexible/Standard/Builders/MatchNoDocsQueryNodeBuilder.cs
b/src/contrib/QueryParsers/Flexible/Standard/Builders/MatchNoDocsQueryNodeBuilder.cs
new file mode 100644
index 0000000..2eba177
--- /dev/null
+++ b/src/contrib/QueryParsers/Flexible/Standard/Builders/MatchNoDocsQueryNodeBuilder.cs
@@ -0,0 +1,41 @@
+using Lucene.Net.QueryParsers.Flexible.Core;
+using Lucene.Net.QueryParsers.Flexible.Core.Builders;
+using Lucene.Net.QueryParsers.Flexible.Core.Messages;
+using Lucene.Net.QueryParsers.Flexible.Core.Nodes;
+using Lucene.Net.QueryParsers.Flexible.Messages;
+using Lucene.Net.QueryParsers.Flexible.Standard.Parser;
+using Lucene.Net.Search;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders
+{
+    public class MatchNoDocsQueryNodeBuilder : IStandardQueryBuilder
+    {
+        public MatchNoDocsQueryNodeBuilder()
+        {
+            // empty constructor
+        }
+
+        public Query Build(IQueryNode queryNode)
+        {
+            // validates node
+            if (!(queryNode is MatchNoDocsQueryNode))
+            {
+                throw new QueryNodeException(new Message(
+                    QueryParserMessages.LUCENE_QUERY_CONVERSION_ERROR, queryNode
+                        .ToQueryString(new EscapeQuerySyntaxImpl()), queryNode.GetType().FullName));
+            }
+
+            return new BooleanQuery();
+        }
+
+        object IQueryBuilder.Build(IQueryNode queryNode)
+        {
+            return Build(queryNode);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c50db238/src/contrib/QueryParsers/Flexible/Standard/Builders/ModifierQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/contrib/QueryParsers/Flexible/Standard/Builders/ModifierQueryNodeBuilder.cs
b/src/contrib/QueryParsers/Flexible/Standard/Builders/ModifierQueryNodeBuilder.cs
new file mode 100644
index 0000000..649c50c
--- /dev/null
+++ b/src/contrib/QueryParsers/Flexible/Standard/Builders/ModifierQueryNodeBuilder.cs
@@ -0,0 +1,31 @@
+using Lucene.Net.QueryParsers.Flexible.Core.Builders;
+using Lucene.Net.QueryParsers.Flexible.Core.Nodes;
+using Lucene.Net.Search;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders
+{
+    public class ModifierQueryNodeBuilder : IStandardQueryBuilder
+    {
+        public ModifierQueryNodeBuilder()
+        {
+            // empty constructor
+        }
+
+        public Query Build(IQueryNode queryNode)
+        {
+            ModifierQueryNode modifierNode = (ModifierQueryNode)queryNode;
+
+            return (Query)(modifierNode).Child.GetTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
+        }
+
+        object IQueryBuilder.Build(IQueryNode queryNode)
+        {
+            return Build(queryNode);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c50db238/src/contrib/QueryParsers/Flexible/Standard/Builders/MultiPhraseQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/contrib/QueryParsers/Flexible/Standard/Builders/MultiPhraseQueryNodeBuilder.cs
b/src/contrib/QueryParsers/Flexible/Standard/Builders/MultiPhraseQueryNodeBuilder.cs
new file mode 100644
index 0000000..fd6f953
--- /dev/null
+++ b/src/contrib/QueryParsers/Flexible/Standard/Builders/MultiPhraseQueryNodeBuilder.cs
@@ -0,0 +1,66 @@
+using Lucene.Net.Index;
+using Lucene.Net.QueryParsers.Flexible.Core.Builders;
+using Lucene.Net.QueryParsers.Flexible.Core.Nodes;
+using Lucene.Net.QueryParsers.Flexible.Standard.Nodes;
+using Lucene.Net.Search;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders
+{
+    public class MultiPhraseQueryNodeBuilder : IStandardQueryBuilder
+    {
+        public MultiPhraseQueryNodeBuilder()
+        {
+            // empty constructor
+        }
+
+        public Query Build(IQueryNode queryNode)
+        {
+            MultiPhraseQueryNode phraseNode = (MultiPhraseQueryNode)queryNode;
+
+            MultiPhraseQuery phraseQuery = new MultiPhraseQuery();
+
+            IList<IQueryNode> children = phraseNode.Children;
+
+            if (children != null)
+            {
+                SortedDictionary<int, IList<Term>> positionTermMap = new SortedDictionary<int,
IList<Term>>();
+
+                foreach (QueryNode child in children)
+                {
+                    FieldQueryNode termNode = (FieldQueryNode)child;
+                    TermQuery termQuery = (TermQuery)termNode
+                        .GetTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
+                    IList<Term> termList = positionTermMap[termNode.PositionIncrement];
+
+                    if (termList == null)
+                    {
+                        termList = new List<Term>();
+                        positionTermMap[termNode.PositionIncrement] = termList;
+
+                    }
+
+                    termList.Add(termQuery.Term);
+                }
+
+                foreach (int positionIncrement in positionTermMap.Keys)
+                {
+                    IList<Term> termList = positionTermMap[positionIncrement];
+
+                    phraseQuery.Add(termList.ToArray(), positionIncrement);
+                }
+            }
+
+            return phraseQuery;
+        }
+
+        object IQueryBuilder.Build(IQueryNode queryNode)
+        {
+            return Build(queryNode);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c50db238/src/contrib/QueryParsers/Flexible/Standard/Nodes/AbstractRangeQueryNode.cs
----------------------------------------------------------------------
diff --git a/src/contrib/QueryParsers/Flexible/Standard/Nodes/AbstractRangeQueryNode.cs b/src/contrib/QueryParsers/Flexible/Standard/Nodes/AbstractRangeQueryNode.cs
new file mode 100644
index 0000000..81b3bca
--- /dev/null
+++ b/src/contrib/QueryParsers/Flexible/Standard/Nodes/AbstractRangeQueryNode.cs
@@ -0,0 +1,167 @@
+using Lucene.Net.QueryParsers.Flexible.Core.Nodes;
+using Lucene.Net.QueryParsers.Flexible.Core.Parser;
+using Lucene.Net.QueryParsers.Flexible.Core.Util;
+using Lucene.Net.Support;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lucene.Net.QueryParsers.Flexible.Standard.Nodes
+{
+    public class AbstractRangeQueryNode<T> : QueryNode, IRangeQueryNode<T>
+        where T : IFieldValuePairQueryNode<T>
+    {
+        private bool lowerInclusive, upperInclusive;
+
+        protected AbstractRangeQueryNode()
+        {
+            SetLeaf(false);
+            Allocate();
+        }
+        
+        public string Field
+        {
+            get
+            {
+                string field = null;
+                T lower = LowerBound;
+                T upper = UpperBound;
+
+                if (lower != null)
+                {
+                    field = lower.Field;
+
+                }
+                else if (upper != null)
+                {
+                    field = upper.Field;
+                }
+
+                return field;
+            }
+            set
+            {
+                T lower = LowerBound;
+                T upper = UpperBound;
+
+                if (lower != null)
+                {
+                    lower.Field = value;
+                }
+
+                if (upper != null)
+                {
+                    upper.Field = value;
+                }
+            }
+        }
+
+        public T LowerBound
+        {
+            get { return (T)Children[0]; }
+        }
+
+        public T UpperBound
+        {
+            get { return (T)Children[1]; }
+        }
+
+        public bool IsLowerInclusive
+        {
+            get { return lowerInclusive; }
+        }
+
+        public bool IsUpperInclusive
+        {
+            get { return upperInclusive; }
+        }
+
+        public void SetBounds(T lower, T upper, bool lowerInclusive, bool upperInclusive)
+        {
+            if (lower != null && upper != null)
+            {
+                String lowerField = StringUtils.ToString(lower.Field);
+                String upperField = StringUtils.ToString(upper.Field);
+
+                if ((upperField != null || lowerField != null)
+                    && ((upperField != null && !upperField.Equals(lowerField))
|| !lowerField.Equals(upperField)))
+                {
+                    throw new ArgumentException(
+                        "lower and upper bounds should have the same field name!");
+                }
+
+                this.lowerInclusive = lowerInclusive;
+                this.upperInclusive = upperInclusive;
+
+                List<IQueryNode> children = new List<IQueryNode>(2);
+                children.Add(lower);
+                children.Add(upper);
+
+                Set(children);
+            }
+        }
+
+        public override ICharSequence ToQueryString(IEscapeQuerySyntax escapeSyntaxParser)
+        {
+            StringBuilder sb = new StringBuilder();
+
+            T lower = LowerBound;
+            T upper = UpperBound;
+
+            if (lowerInclusive)
+            {
+                sb.Append('[');
+            }
+            else
+            {
+                sb.Append('{');
+            }
+
+            if (lower != null)
+            {
+                sb.Append(lower.ToQueryString(escapeSyntaxParser));
+            }
+            else
+            {
+                sb.Append("...");
+            }
+
+            sb.Append(' ');
+
+            if (upper != null)
+            {
+                sb.Append(upper.ToQueryString(escapeSyntaxParser));
+            }
+            else
+            {
+                sb.Append("...");
+            }
+
+            if (upperInclusive)
+            {
+                sb.Append(']');
+            }
+            else
+            {
+                sb.Append('}');
+            }
+
+            return new StringCharSequenceWrapper(sb.ToString());    
+        }
+
+        public override string ToString()
+        {
+            StringBuilder sb = new StringBuilder("<").Append(GetType().FullName);
+            sb.Append(" lowerInclusive=").Append(IsLowerInclusive);
+            sb.Append(" upperInclusive=").Append(IsUpperInclusive);
+            sb.Append(">\n\t");
+            sb.Append(UpperBound).Append("\n\t");
+            sb.Append(LowerBound).Append("\n");
+            sb.Append("</").Append(GetType().FullName).Append(">\n");
+
+            return sb.ToString();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c50db238/src/contrib/QueryParsers/Flexible/Standard/Nodes/BooleanModifierNode.cs
----------------------------------------------------------------------
diff --git a/src/contrib/QueryParsers/Flexible/Standard/Nodes/BooleanModifierNode.cs b/src/contrib/QueryParsers/Flexible/Standard/Nodes/BooleanModifierNode.cs
new file mode 100644
index 0000000..a734ad2
--- /dev/null
+++ b/src/contrib/QueryParsers/Flexible/Standard/Nodes/BooleanModifierNode.cs
@@ -0,0 +1,17 @@
+using Lucene.Net.QueryParsers.Flexible.Core.Nodes;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lucene.Net.QueryParsers.Flexible.Standard.Nodes
+{
+    public class BooleanModifierNode : ModifierQueryNode
+    {
+        public BooleanModifierNode(IQueryNode node, Modifier mod)
+            : base(node, mod)
+        {
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c50db238/src/contrib/QueryParsers/Flexible/Standard/Nodes/MultiPhraseQueryNode.cs
----------------------------------------------------------------------
diff --git a/src/contrib/QueryParsers/Flexible/Standard/Nodes/MultiPhraseQueryNode.cs b/src/contrib/QueryParsers/Flexible/Standard/Nodes/MultiPhraseQueryNode.cs
new file mode 100644
index 0000000..3fc3230
--- /dev/null
+++ b/src/contrib/QueryParsers/Flexible/Standard/Nodes/MultiPhraseQueryNode.cs
@@ -0,0 +1,92 @@
+using Lucene.Net.QueryParsers.Flexible.Core.Nodes;
+using Lucene.Net.QueryParsers.Flexible.Core.Parser;
+using Lucene.Net.Support;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lucene.Net.QueryParsers.Flexible.Standard.Nodes
+{
+    public class MultiPhraseQueryNode : QueryNode, IFieldableNode
+    {
+        public MultiPhraseQueryNode()
+        {
+            SetLeaf(false);
+            Allocate();
+        }
+
+        public override string ToString()
+        {
+            if (Children == null || Children.Count == 0)
+                return "<multiPhrase/>";
+            StringBuilder sb = new StringBuilder();
+            sb.Append("<multiPhrase>");
+            foreach (IQueryNode child in Children)
+            {
+                sb.Append("\n");
+                sb.Append(child.ToString());
+            }
+            sb.Append("\n</multiPhrase>");
+            return sb.ToString();
+        }
+
+        public override ICharSequence ToQueryString(IEscapeQuerySyntax escapeSyntaxParser)
+        {
+            if (Children == null || Children.Count == 0)
+                return new StringCharSequenceWrapper("");
+
+            StringBuilder sb = new StringBuilder();
+            String filler = "";
+            foreach (IQueryNode child in Children)
+            {
+                sb.Append(filler).Append(child.ToQueryString(escapeSyntaxParser));
+                filler = ",";
+            }
+
+            return new StringCharSequenceWrapper("[MTP[" + sb.ToString() + "]]");
+        }
+
+        public override IQueryNode CloneTree()
+        {
+            MultiPhraseQueryNode clone = (MultiPhraseQueryNode)base.CloneTree();
+
+            // nothing to do
+
+            return clone;
+        }
+
+        public string Field
+        {
+            get
+            {
+                IList<IQueryNode> children = Children;
+
+                if (children == null || children.Count == 0)
+                {
+                    return null;
+                }
+                else
+                {
+                    return ((IFieldableNode)children[0]).Field;
+                }
+            }
+            set
+            {
+                IList<IQueryNode> children = Children;
+
+                if (children != null)
+                {
+                    foreach (IQueryNode child in children)
+                    {
+                        if (child is IFieldableNode)
+                        {
+                            ((IFieldableNode)child).Field = value;
+                        }
+                    }
+                }
+            }
+        }
+    }
+}


Mime
View raw message