You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2016/12/06 15:12:00 UTC
[25/58] lucenenet git commit: QueryParser.Flexible refactor:
Formatting, removed commented code, changed some properties
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/BoostQueryNodeProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/BoostQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/BoostQueryNodeProcessor.cs
index 3d9b5f2..c9ebf8b 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/BoostQueryNodeProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/BoostQueryNodeProcessor.cs
@@ -23,11 +23,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
{
protected override IQueryNode PostProcessNode(IQueryNode node)
{
-
if (node is IFieldableNode &&
(node.Parent == null || !(node.Parent is IFieldableNode)))
{
-
IFieldableNode fieldNode = (IFieldableNode)node;
QueryConfigHandler config = GetQueryConfigHandler();
@@ -44,31 +42,21 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
{
return new BoostQueryNode(node, boost.Value);
}
-
}
-
}
-
}
return node;
-
}
-
protected override IQueryNode PreProcessNode(IQueryNode node)
{
-
return node;
-
}
-
protected override IList<IQueryNode> SetChildrenOrder(IList<IQueryNode> children)
{
-
return children;
-
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/DefaultPhraseSlopQueryNodeProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/DefaultPhraseSlopQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/DefaultPhraseSlopQueryNodeProcessor.cs
index f52ebba..18bc691 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/DefaultPhraseSlopQueryNodeProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/DefaultPhraseSlopQueryNodeProcessor.cs
@@ -32,7 +32,6 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
// empty constructor
}
-
public override IQueryNode Process(IQueryNode queryTree)
{
QueryConfigHandler queryConfig = GetQueryConfigHandler();
@@ -46,67 +45,48 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
this.defaultPhraseSlop = defaultPhraseSlop.Value;
return base.Process(queryTree);
-
}
-
}
return queryTree;
-
}
-
protected override IQueryNode PostProcessNode(IQueryNode node)
{
-
if (node is TokenizedPhraseQueryNode
|| node is MultiPhraseQueryNode)
{
-
return new SlopQueryNode(node, this.defaultPhraseSlop);
-
}
return node;
-
}
-
protected override IQueryNode PreProcessNode(IQueryNode node)
{
-
if (node is SlopQueryNode)
{
this.processChildren = false;
-
}
return node;
-
}
-
protected override void ProcessChildren(IQueryNode queryTree)
{
-
if (this.processChildren)
{
base.ProcessChildren(queryTree);
-
}
else
{
this.processChildren = true;
}
-
}
-
protected override IList<IQueryNode> SetChildrenOrder(IList<IQueryNode> children)
{
-
return children;
-
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/FuzzyQueryNodeProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/FuzzyQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/FuzzyQueryNodeProcessor.cs
index 13b309b..0c1f20a 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/FuzzyQueryNodeProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/FuzzyQueryNodeProcessor.cs
@@ -23,18 +23,13 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
/// <seealso cref="FuzzyQueryNode"/>
public class FuzzyQueryNodeProcessor : QueryNodeProcessorImpl
{
-
protected override IQueryNode PostProcessNode(IQueryNode node)
{
-
return node;
-
}
-
protected override IQueryNode PreProcessNode(IQueryNode node)
{
-
if (node is FuzzyQueryNode)
{
FuzzyQueryNode fuzzyNode = (FuzzyQueryNode)node;
@@ -50,26 +45,19 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
{
fuzzyNode.Similarity = fuzzyConfig.MinSimilarity;
}
-
}
else if (fuzzyNode.Similarity < 0)
{
throw new ArgumentException("No FUZZY_CONFIG set in the config");
}
-
}
return node;
-
}
-
protected override IList<IQueryNode> SetChildrenOrder(IList<IQueryNode> children)
{
-
return children;
-
}
-
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/GroupQueryNodeProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/GroupQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/GroupQueryNodeProcessor.cs
index dcc6f44..9f7f4eb 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/GroupQueryNodeProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/GroupQueryNodeProcessor.cs
@@ -41,7 +41,6 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
// empty constructor
}
-
public virtual IQueryNode Process(IQueryNode queryTree)
{
Operator? defaultOperator = GetQueryConfigHandler().Get(ConfigurationKeys.DEFAULT_OPERATOR);
@@ -73,7 +72,6 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
{
actualQueryNodeList[i] = Process(node);
}
-
}
this.usingAnd = false;
@@ -83,101 +81,79 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
queryTree.Set(actualQueryNodeList);
return queryTree;
-
}
else
{
return new BooleanQueryNode(actualQueryNodeList);
}
-
}
/**
*/
private IQueryNode ApplyModifier(IQueryNode node, IQueryNode parent)
{
-
if (this.usingAnd)
{
-
if (parent is OrQueryNode)
{
-
if (node is ModifierQueryNode)
{
-
ModifierQueryNode modNode = (ModifierQueryNode)node;
if (modNode.Modifier == Modifier.MOD_REQ)
{
return modNode.GetChild();
}
-
}
-
}
else
{
-
if (node is ModifierQueryNode)
{
-
ModifierQueryNode modNode = (ModifierQueryNode)node;
if (modNode.Modifier == Modifier.MOD_NONE)
{
return new BooleanModifierNode(modNode.GetChild(), Modifier.MOD_REQ);
}
-
}
else
{
return new BooleanModifierNode(node, Modifier.MOD_REQ);
}
-
}
-
}
else
{
-
if (node.Parent is AndQueryNode)
{
-
if (node is ModifierQueryNode)
{
-
ModifierQueryNode modNode = (ModifierQueryNode)node;
if (modNode.Modifier == Modifier.MOD_NONE)
{
return new BooleanModifierNode(modNode.GetChild(), Modifier.MOD_REQ);
}
-
}
else
{
return new BooleanModifierNode(node, Modifier.MOD_REQ);
}
-
}
-
}
return node;
-
}
private void ReadTree(IQueryNode node)
{
-
if (node is BooleanQueryNode)
{
IList<IQueryNode> children = node.GetChildren();
if (children != null && children.Count > 0)
{
-
for (int i = 0; i < children.Count - 1; i++)
{
ReadTree(children[i]);
@@ -185,27 +161,22 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
ProcessNode(node);
ReadTree(children[children.Count - 1]);
-
}
else
{
ProcessNode(node);
}
-
}
else
{
ProcessNode(node);
}
-
}
private void ProcessNode(IQueryNode node)
{
-
if (node is AndQueryNode || node is OrQueryNode)
{
-
if (!this.latestNodeVerified && this.queryNodeList.Any())
{
var value = this.queryNodeList[this.queryNodeList.Count - 1];
@@ -213,26 +184,20 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
this.queryNodeList.Add(ApplyModifier(value, node));
this.latestNodeVerified = true;
-
}
-
}
else if (!(node is BooleanQueryNode))
{
this.queryNodeList.Add(ApplyModifier(node, node.Parent));
this.latestNodeVerified = false;
-
}
-
}
-
public virtual QueryConfigHandler GetQueryConfigHandler()
{
return this.queryConfig;
}
-
public virtual void SetQueryConfigHandler(QueryConfigHandler queryConfigHandler)
{
this.queryConfig = queryConfigHandler;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/LowercaseExpandedTermsQueryNodeProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/LowercaseExpandedTermsQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/LowercaseExpandedTermsQueryNodeProcessor.cs
index 505ed07..9a4528e 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/LowercaseExpandedTermsQueryNodeProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/LowercaseExpandedTermsQueryNodeProcessor.cs
@@ -28,7 +28,6 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
{
}
-
public override IQueryNode Process(IQueryNode queryTree)
{
bool? lowercaseExpandedTerms = GetQueryConfigHandler().Get(ConfigurationKeys.LOWERCASE_EXPANDED_TERMS);
@@ -39,13 +38,10 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
}
return queryTree;
-
}
-
protected override IQueryNode PostProcessNode(IQueryNode node)
{
-
CultureInfo locale = GetQueryConfigHandler().Get(ConfigurationKeys.LOCALE);
if (locale == null)
{
@@ -57,31 +53,22 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
|| (node is FieldQueryNode && node.Parent is IRangeQueryNode)
|| node is RegexpQueryNode)
{
-
ITextableQueryNode txtNode = (ITextableQueryNode)node;
ICharSequence text = txtNode.Text;
txtNode.Text = text != null ? UnescapedCharSequence.ToLowerCase(text, locale) : null;
}
return node;
-
}
-
protected override IQueryNode PreProcessNode(IQueryNode node)
{
-
return node;
-
}
-
protected override IList<IQueryNode> SetChildrenOrder(IList<IQueryNode> children)
{
-
return children;
-
}
-
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/MatchAllDocsQueryNodeProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/MatchAllDocsQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/MatchAllDocsQueryNodeProcessor.cs
index 4fda65e..342b17f 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/MatchAllDocsQueryNodeProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/MatchAllDocsQueryNodeProcessor.cs
@@ -21,10 +21,8 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
// empty constructor
}
-
protected override IQueryNode PostProcessNode(IQueryNode node)
{
-
if (node is FieldQueryNode)
{
FieldQueryNode fqn = (FieldQueryNode)node;
@@ -32,31 +30,21 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
if (fqn.Field.ToString().Equals("*")
&& fqn.Text.ToString().Equals("*"))
{
-
return new MatchAllDocsQueryNode();
-
}
-
}
return node;
-
}
-
protected override IQueryNode PreProcessNode(IQueryNode node)
{
-
return node;
-
}
protected override IList<IQueryNode> SetChildrenOrder(IList<IQueryNode> children)
{
-
return children;
-
}
-
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/MultiFieldQueryNodeProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/MultiFieldQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/MultiFieldQueryNodeProcessor.cs
index 1ec617d..b0443e9 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/MultiFieldQueryNodeProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/MultiFieldQueryNodeProcessor.cs
@@ -31,33 +31,25 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
// empty constructor
}
-
protected override IQueryNode PostProcessNode(IQueryNode node)
{
-
return node;
-
}
-
protected override void ProcessChildren(IQueryNode queryTree)
{
-
if (this.processChildren)
{
base.ProcessChildren(queryTree);
-
}
else
{
this.processChildren = true;
}
-
}
protected override IQueryNode PreProcessNode(IQueryNode node)
{
-
if (node is IFieldableNode)
{
this.processChildren = false;
@@ -80,7 +72,6 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
if (fields.Length == 1)
{
return fieldNode;
-
}
else
{
@@ -89,42 +80,24 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
for (int i = 1; i < fields.Length; i++)
{
- //try
- //{
fieldNode = (IFieldableNode)fieldNode.CloneTree();
fieldNode.Field = fields[i];
children.Add(fieldNode);
-
- //}
- //catch (CloneNotSupportedException e)
- //{
- // // should never happen
- //}
-
}
return new GroupQueryNode(new OrQueryNode(children));
-
}
-
}
-
}
-
}
return node;
-
}
-
protected override IList<IQueryNode> SetChildrenOrder(IList<IQueryNode> children)
{
-
return children;
-
}
-
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/MultiTermRewriteMethodProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/MultiTermRewriteMethodProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/MultiTermRewriteMethodProcessor.cs
index 33e31b5..3a5c506 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/MultiTermRewriteMethodProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/MultiTermRewriteMethodProcessor.cs
@@ -21,16 +21,13 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
{
public static readonly string TAG_ID = "MultiTermRewriteMethodConfiguration";
-
protected override IQueryNode PostProcessNode(IQueryNode node)
{
-
// set setMultiTermRewriteMethod for WildcardQueryNode and
// PrefixWildcardQueryNode
if (node is WildcardQueryNode
|| node is IAbstractRangeQueryNode || node is RegexpQueryNode)
{
-
MultiTermQuery.RewriteMethod rewriteMethod = GetQueryConfigHandler().Get(ConfigurationKeys.MULTI_TERM_REWRITE_METHOD);
if (rewriteMethod == null)
@@ -43,19 +40,16 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
// use a TAG to take the value to the Builder
node.SetTag(MultiTermRewriteMethodProcessor.TAG_ID, rewriteMethod);
-
}
return node;
}
-
protected override IQueryNode PreProcessNode(IQueryNode node)
{
return node;
}
-
protected override IList<IQueryNode> SetChildrenOrder(IList<IQueryNode> children)
{
return children;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericQueryNodeProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericQueryNodeProcessor.cs
index 5772699..114aded 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericQueryNodeProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericQueryNodeProcessor.cs
@@ -46,14 +46,11 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
// empty constructor
}
-
protected override IQueryNode PostProcessNode(IQueryNode node)
{
-
if (node is FieldQueryNode
&& !(node.Parent is IRangeQueryNode))
{
-
QueryConfigHandler config = GetQueryConfigHandler();
if (config != null)
@@ -69,7 +66,6 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
if (numericConfig != null)
{
-
NumberFormat numberFormat = numericConfig.NumberFormat;
string text = fieldNode.GetTextAsString();
/*Number*/
@@ -77,12 +73,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
if (text.Length > 0)
{
-
try
{
number = numberFormat.Parse(text);
- //number = decimal.Parse(text, NumberStyles.Any);// LUCENENET TODO: use the current culture?
-
}
catch (FormatException e)
{
@@ -122,26 +115,19 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
return new NumericRangeQueryNode(lowerNode, upperNode, true, true,
numericConfig);
-
}
-
}
-
}
-
}
return node;
-
}
-
protected override IQueryNode PreProcessNode(IQueryNode node)
{
return node;
}
-
protected override IList<IQueryNode> SetChildrenOrder(IList<IQueryNode> children)
{
return children;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericRangeQueryNodeProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericRangeQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericRangeQueryNodeProcessor.cs
index 98d3c6f..81c2849 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericRangeQueryNodeProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/NumericRangeQueryNodeProcessor.cs
@@ -41,10 +41,8 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
// empty constructor
}
-
protected override IQueryNode PostProcessNode(IQueryNode node)
{
-
if (node is TermRangeQueryNode)
{
QueryConfigHandler config = GetQueryConfigHandler();
@@ -57,13 +55,11 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
if (fieldConfig != null)
{
-
NumericConfig numericConfig = fieldConfig
.Get(ConfigurationKeys.NUMERIC_CONFIG);
if (numericConfig != null)
{
-
FieldQueryNode lower = (FieldQueryNode)termRangeNode.LowerBound;
FieldQueryNode upper = (FieldQueryNode)termRangeNode.UpperBound;
@@ -75,11 +71,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
if (lowerText.Length > 0)
{
-
try
{
lowerNumber = numberFormat.Parse(lowerText);
- //lowerNumber = decimal.Parse(lowerText, NumberStyles.Any);// LUCENENET TODO: use the current culture?
}
catch (FormatException e)
{
@@ -88,16 +82,13 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
.GetTextAsString(), numberFormat.GetType()
.AssemblyQualifiedName), e);
}
-
}
if (upperText.Length > 0)
{
-
try
{
upperNumber = numberFormat.Parse(upperText);
- //upperNumber = decimal.Parse(upperText, NumberStyles.Any);// LUCENENET TODO: use the current culture?
}
catch (FormatException e)
{
@@ -106,7 +97,6 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
.GetTextAsString(), numberFormat.GetType()
.AssemblyQualifiedName), e);
}
-
}
switch (numericConfig.Type)
@@ -139,17 +129,12 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
return new NumericRangeQueryNode(lowerNode, upperNode,
lowerInclusive, upperInclusive, numericConfig);
-
}
-
}
-
}
-
}
return node;
-
}
protected override IQueryNode PreProcessNode(IQueryNode node)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/OpenRangeQueryNodeProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/OpenRangeQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/OpenRangeQueryNodeProcessor.cs
index 9fbf008..2f9ae47 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/OpenRangeQueryNodeProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/OpenRangeQueryNodeProcessor.cs
@@ -20,10 +20,8 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
public OpenRangeQueryNodeProcessor() { }
-
protected override IQueryNode PostProcessNode(IQueryNode node)
{
-
if (node is TermRangeQueryNode)
{
TermRangeQueryNode rangeNode = (TermRangeQueryNode)node;
@@ -51,16 +49,13 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
}
return node;
-
}
-
protected override IQueryNode PreProcessNode(IQueryNode node)
{
return node;
}
-
protected override IList<IQueryNode> SetChildrenOrder(IList<IQueryNode> children)
{
return children;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/PhraseSlopQueryNodeProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/PhraseSlopQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/PhraseSlopQueryNodeProcessor.cs
index 2aa76de..066807b 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/PhraseSlopQueryNodeProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/PhraseSlopQueryNodeProcessor.cs
@@ -22,10 +22,8 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
// empty constructor
}
-
protected override IQueryNode PostProcessNode(IQueryNode node)
{
-
if (node is SlopQueryNode)
{
SlopQueryNode phraseSlopNode = (SlopQueryNode)node;
@@ -35,27 +33,19 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
{
return phraseSlopNode.GetChild();
}
-
}
return node;
-
}
-
protected override IQueryNode PreProcessNode(IQueryNode node)
{
-
return node;
-
}
-
protected override IList<IQueryNode> SetChildrenOrder(IList<IQueryNode> children)
{
-
return children;
-
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/RemoveEmptyNonLeafQueryNodeProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/RemoveEmptyNonLeafQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/RemoveEmptyNonLeafQueryNodeProcessor.cs
index c4bdd53..d961085 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/RemoveEmptyNonLeafQueryNodeProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/RemoveEmptyNonLeafQueryNodeProcessor.cs
@@ -29,74 +29,56 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
// empty constructor
}
-
public override IQueryNode Process(IQueryNode queryTree)
{
queryTree = base.Process(queryTree);
if (!queryTree.IsLeaf)
{
-
IList<IQueryNode> children = queryTree.GetChildren();
if (children == null || children.Count == 0)
{
return new MatchNoDocsQueryNode();
}
-
}
return queryTree;
-
}
-
protected override IQueryNode PostProcessNode(IQueryNode node)
{
-
return node;
-
}
-
protected override IQueryNode PreProcessNode(IQueryNode node)
{
-
return node;
-
}
-
protected override IList<IQueryNode> SetChildrenOrder(IList<IQueryNode> children)
{
-
try
{
-
foreach (IQueryNode child in children)
{
-
if (!child.IsLeaf)
{
-
IList<IQueryNode> grandChildren = child.GetChildren();
if (grandChildren != null && grandChildren.Count > 0)
{
this.childrenBuffer.Add(child);
}
-
}
else
{
this.childrenBuffer.Add(child);
}
-
}
children.Clear();
children.AddRange(this.childrenBuffer);
-
}
finally
{
@@ -104,7 +86,6 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
}
return children;
-
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/TermRangeQueryNodeProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/TermRangeQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/TermRangeQueryNodeProcessor.cs
index 6ddbd75..8590a69 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/TermRangeQueryNodeProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/TermRangeQueryNodeProcessor.cs
@@ -39,10 +39,8 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
// empty constructor
}
-
protected override IQueryNode PostProcessNode(IQueryNode node)
{
-
if (node is TermRangeQueryNode)
{
TermRangeQueryNode termRangeNode = (TermRangeQueryNode)node;
@@ -130,35 +128,25 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
part2 = DateTools.DateToString(d2, dateRes);
upper.Text = new StringCharSequenceWrapper(part2);
-
}
-
}
catch (Exception e)
{
// do nothing
}
-
}
return node;
-
}
-
protected override IQueryNode PreProcessNode(IQueryNode node)
{
-
return node;
-
}
-
protected override IList<IQueryNode> SetChildrenOrder(IList<IQueryNode> children)
{
-
return children;
-
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/WildcardQueryNodeProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/WildcardQueryNodeProcessor.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/WildcardQueryNodeProcessor.cs
index 868daed..1fd1b5d 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/WildcardQueryNodeProcessor.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Processors/WildcardQueryNodeProcessor.cs
@@ -27,10 +27,8 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
// empty constructor
}
-
protected override IQueryNode PostProcessNode(IQueryNode node)
{
-
// the old Lucene Parser ignores FuzzyQueryNode that are also PrefixWildcardQueryNode or WildcardQueryNode
// we do the same here, also ignore empty terms
if (node is FieldQueryNode || node is FuzzyQueryNode)
@@ -54,18 +52,15 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
{
PrefixWildcardQueryNode prefixWildcardQN = new PrefixWildcardQueryNode(fqn);
return prefixWildcardQN;
-
}
else if (IsWildcard(text))
{
WildcardQueryNode wildcardQN = new WildcardQueryNode(fqn);
return wildcardQN;
}
-
}
return node;
-
}
private bool IsWildcard(string text)
@@ -112,20 +107,14 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Processors
return false;
}
-
protected override IQueryNode PreProcessNode(IQueryNode node)
{
-
return node;
-
}
-
protected override IList<IQueryNode> SetChildrenOrder(IList<IQueryNode> children)
{
-
return children;
-
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.QueryParser/Flexible/Standard/QueryParserUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/QueryParserUtil.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/QueryParserUtil.cs
index 55eb099..0afd0de 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/QueryParserUtil.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/QueryParserUtil.cs
@@ -46,7 +46,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
for (int i = 0; i < fields.Length; i++)
{
- Query q = qp.Parse(queries[i], fields[i]) as Query;
+ Query q = qp.Parse(queries[i], fields[i]);
if (q != null && // q never null, just being defensive
(!(q is BooleanQuery) || ((BooleanQuery)q).GetClauses().Count > 0))
@@ -105,7 +105,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
for (int i = 0; i < fields.Length; i++)
{
- Query q = qp.Parse(query, fields[i]) as Query;
+ Query q = qp.Parse(query, fields[i]);
if (q != null && // q never null, just being defensive
(!(q is BooleanQuery) || ((BooleanQuery)q).GetClauses().Count > 0))
@@ -165,7 +165,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
for (int i = 0; i < fields.Length; i++)
{
- Query q = qp.Parse(queries[i], fields[i]) as Query;
+ Query q = qp.Parse(queries[i], fields[i]);
if (q != null && // q never null, just being defensive
(!(q is BooleanQuery) || ((BooleanQuery)q).GetClauses().Count > 0))
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.QueryParser/Flexible/Standard/StandardQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/StandardQueryParser.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/StandardQueryParser.cs
index 498ea99..2f421d6 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/StandardQueryParser.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/StandardQueryParser.cs
@@ -19,10 +19,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
{
public class StandardQueryParser : QueryParserHelper<Query>, ICommonQueryParserConfiguration
{
-
- /**
-* Constructs a {@link StandardQueryParser} object.
-*/
+ /// <summary>
+ /// Constructs a <see cref="StandardQueryParser"/> object.
+ /// </summary>
public StandardQueryParser()
: base(new StandardQueryConfigHandler(), new StandardSyntaxParser(),
new StandardQueryNodeProcessorPipeline(null),
@@ -31,77 +30,65 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
EnablePositionIncrements = true;
}
- /**
- * Constructs a {@link StandardQueryParser} object and sets an
- * {@link Analyzer} to it. The same as:
- *
- * <ul>
- * StandardQueryParser qp = new StandardQueryParser();
- * qp.getQueryConfigHandler().setAnalyzer(analyzer);
- * </ul>
- *
- * @param analyzer
- * the analyzer to be used by this query parser helper
- */
+ /// <summary>
+ /// Constructs a <see cref="StandardQueryParser"/> object and sets an
+ /// <see cref="Analyzer"/> to it. The same as:
+ /// <code>
+ /// StandardQueryParser qp = new StandardQueryParser();
+ /// qp.QueryConfigHandler.Analyzer = analyzer;
+ /// </code>
+ /// </summary>
+ /// <param name="analyzer">the analyzer to be used by this query parser helper</param>
public StandardQueryParser(Analyzer analyzer)
: this()
{
this.Analyzer = analyzer;
}
-
public override string ToString()
{
return "<StandardQueryParser config=\"" + this.QueryConfigHandler
+ "\"/>";
}
- /**
- * Overrides {@link QueryParserHelper#parse(String, String)} so it casts the
- * return object to {@link Query}. For more reference about this method, check
- * {@link QueryParserHelper#parse(String, String)}.
- *
- * @param query
- * the query string
- * @param defaultField
- * the default field used by the text parser
- *
- * @return the object built from the query
- *
- * @throws QueryNodeException
- * if something wrong happens along the three phases
- */
+ /// <summary>
+ /// Overrides <see cref="QueryParserHelper{TQuery}.Parse(string, string)"/> so it casts the
+ /// return object to <see cref="Query"/>. For more reference about this method, check
+ /// <see cref="QueryParserHelper{TQuery}.Parse(string, string)"/>.
+ /// </summary>
+ /// <param name="query">the query string</param>
+ /// <param name="defaultField">the default field used by the text parser</param>
+ /// <returns>the object built from the query</returns>
+ /// <exception cref="QueryNodeException">if something wrong happens along the three phases</exception>
public override Query Parse(string query, string defaultField)
{
-
return base.Parse(query, defaultField);
-
}
- /**
- * Gets implicit operator setting, which will be either {@link Operator#AND}
- * or {@link Operator#OR}.
- */
+ /// <summary>
+ /// Gets or Sets the boolean operator of the QueryParser. In default mode (
+ /// <see cref="Operator.OR"/>) terms without any modifiers are considered optional:
+ /// for example <c>capital of Hungary</c> is equal to
+ /// <c>capital OR of OR Hungary</c>.
+ /// <para/>
+ /// In <see cref="Operator.AND"/> mode terms are considered to be in conjunction: the
+ /// above mentioned query is parsed as <c>capital AND of AND Hungary</c>
+ /// </summary>
public virtual Operator? DefaultOperator
{
get { return QueryConfigHandler.Get(ConfigurationKeys.DEFAULT_OPERATOR); }
set { QueryConfigHandler.Set(ConfigurationKeys.DEFAULT_OPERATOR, value); }
}
- ///**
- // * Sets the boolean operator of the QueryParser. In default mode (
- // * {@link Operator#OR}) terms without any modifiers are considered optional:
- // * for example <code>capital of Hungary</code> is equal to
- // * <code>capital OR of OR Hungary</code>.<br/>
- // * In {@link Operator#AND} mode terms are considered to be in conjunction: the
- // * above mentioned query is parsed as <code>capital AND of AND Hungary</code>
- // */
- //public virtual void SetDefaultOperator(Operator @operator)
- //{
- // QueryConfigHandler.Set(ConfigurationKeys.DEFAULT_OPERATOR, @operator);
- //}
-
-
+ /// <summary>
+ /// Set to <c>true</c> to allow leading wildcard characters.
+ /// <para/>
+ /// When set, <c>*</c> or <c>?</c> are allowed as the first
+ /// character of a PrefixQuery and WildcardQuery. Note that this can produce
+ /// very slow queries on big indexes.
+ /// <para/>
+ /// Default: false.
+ /// </summary>
public virtual bool LowercaseExpandedTerms
{
get
@@ -115,41 +102,15 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
}
}
- ///**
- // * Set to <code>true</code> to allow leading wildcard characters.
- // * <p>
- // * When set, <code>*</code> or <code>?</code> are allowed as the first
- // * character of a PrefixQuery and WildcardQuery. Note that this can produce
- // * very slow queries on big indexes.
- // * <p>
- // * Default: false.
- // */
-
- //public override void SetLowercaseExpandedTerms(bool lowercaseExpandedTerms)
- //{
- // GetQueryConfigHandler().Set(ConfigurationKeys.LOWERCASE_EXPANDED_TERMS, lowercaseExpandedTerms);
- //}
-
- ///**
- // * @see #setLowercaseExpandedTerms(boolean)
- // */
-
- //public override bool GetLowercaseExpandedTerms()
- //{
- // bool? lowercaseExpandedTerms = GetQueryConfigHandler().Get(ConfigurationKeys.LOWERCASE_EXPANDED_TERMS);
-
- // if (lowercaseExpandedTerms == null)
- // {
- // return true;
-
- // }
- // else
- // {
- // return lowercaseExpandedTerms.Value;
- // }
-
- //}
-
+ /// <summary>
+ /// Set to <c>true</c> to allow leading wildcard characters.
+ /// <para/>
+ /// When set, <c>*</c> or <c>?</c> are allowed as the first
+ /// character of a PrefixQuery and WildcardQuery. Note that this can produce
+ /// very slow queries on big indexes.
+ /// <para/>
+ /// Default: false.
+ /// </summary>
public virtual bool AllowLeadingWildcard
{
get
@@ -163,21 +124,15 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
}
}
- ///**
- // * Set to <code>true</code> to allow leading wildcard characters.
- // * <p>
- // * When set, <code>*</code> or <code>?</code> are allowed as the first
- // * character of a PrefixQuery and WildcardQuery. Note that this can produce
- // * very slow queries on big indexes.
- // * <p>
- // * Default: false.
- // */
-
- //public override void SetAllowLeadingWildcard(bool allowLeadingWildcard)
- //{
- // GetQueryConfigHandler().Set(ConfigurationKeys.ALLOW_LEADING_WILDCARD, allowLeadingWildcard);
- //}
-
+ /// <summary>
+ /// Set to <c>true</c> to enable position increments in result query.
+ /// <para/>
+ /// When set, result phrase and multi-phrase queries will be aware of position
+ /// increments. Useful when e.g. a StopFilter increases the position increment
+ /// of the token that follows an omitted token.
+ /// <para/>
+ /// Default: false.
+ /// </summary>
public virtual bool EnablePositionIncrements
{
get
@@ -191,41 +146,16 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
}
}
- ///**
- // * Set to <code>true</code> to enable position increments in result query.
- // * <p>
- // * When set, result phrase and multi-phrase queries will be aware of position
- // * increments. Useful when e.g. a StopFilter increases the position increment
- // * of the token that follows an omitted token.
- // * <p>
- // * Default: false.
- // */
-
- //public override void SetEnablePositionIncrements(bool enabled)
- //{
- // GetQueryConfigHandler().Set(ConfigurationKeys.ENABLE_POSITION_INCREMENTS, enabled);
- //}
-
- ///**
- // * @see #setEnablePositionIncrements(boolean)
- // */
-
- //public override bool GetEnablePositionIncrements()
- //{
- // bool? enablePositionsIncrements = GetQueryConfigHandler().Get(ConfigurationKeys.ENABLE_POSITION_INCREMENTS);
-
- // if (enablePositionsIncrements == null)
- // {
- // return false;
-
- // }
- // else
- // {
- // return enablePositionsIncrements.Value;
- // }
-
- //}
-
+ /// <summary>
+ /// By default, it uses
+ /// <see cref="MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT"/> when creating a
+ /// prefix, wildcard and range queries. This implementation is generally
+ /// preferable because it a) Runs faster b) Does not have the scarcity of terms
+ /// unduly influence score c) avoids any Exception due to too many listeners.
+ /// However, if your application really needs to use the
+ /// old-fashioned boolean queries expansion rewriting and the above points are
+ /// not relevant then use this change the rewrite method.
+ /// </summary>
public virtual MultiTermQuery.RewriteMethod MultiTermRewriteMethod
{
get
@@ -238,37 +168,11 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
}
}
- ///**
- // * By default, it uses
- // * {@link MultiTermQuery#CONSTANT_SCORE_AUTO_REWRITE_DEFAULT} when creating a
- // * prefix, wildcard and range queries. This implementation is generally
- // * preferable because it a) Runs faster b) Does not have the scarcity of terms
- // * unduly influence score c) avoids any {@link TooManyListenersException}
- // * exception. However, if your application really needs to use the
- // * old-fashioned boolean queries expansion rewriting and the above points are
- // * not relevant then use this change the rewrite method.
- // */
-
- //public override void SetMultiTermRewriteMethod(MultiTermQuery.RewriteMethod method)
- //{
- // GetQueryConfigHandler().Set(ConfigurationKeys.MULTI_TERM_REWRITE_METHOD, method);
- //}
-
- ///**
- // * @see #setMultiTermRewriteMethod(org.apache.lucene.search.MultiTermQuery.RewriteMethod)
- // */
-
- //public override MultiTermQuery.RewriteMethod GetMultiTermRewriteMethod()
- //{
- // return GetQueryConfigHandler().Get(ConfigurationKeys.MULTI_TERM_REWRITE_METHOD);
- //}
-
- /**
- * Set the fields a query should be expanded to when the field is
- * <code>null</code>
- *
- * @param fields the fields used to expand the query
- */
+ /// <summary>
+ /// Set the fields a query should be expanded to when the field is
+ /// <c>null</c>
+ /// </summary>
+ /// <param name="fields">the fields used to expand the query</param>
public virtual void SetMultiFields(string[] fields)
{
@@ -281,17 +185,19 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
}
- /**
- * Returns the fields used to expand the query when the field for a
- * certain query is <code>null</code>
- *
- * @param fields the fields used to expand the query
- */
+ /// <summary>
+ /// Returns the fields used to expand the query when the field for a
+ /// certain query is <c>null</c>
+ /// </summary>
+ /// <returns>the fields used to expand the query</returns>
public virtual string[] GetMultiFields()
{
return QueryConfigHandler.Get(ConfigurationKeys.MULTI_FIELDS);
}
+ /// <summary>
+ /// Gets or Sets the prefix length for fuzzy queries. Default is 0.
+ /// </summary>
public virtual int FuzzyPrefixLength
{
get
@@ -322,39 +228,15 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
}
}
- ///**
- // * Set the prefix length for fuzzy queries. Default is 0.
- // *
- // * @param fuzzyPrefixLength
- // * The fuzzyPrefixLength to set.
- // */
-
- //public void SetFuzzyPrefixLength(int fuzzyPrefixLength)
- //{
- // QueryConfigHandler config = GetQueryConfigHandler();
- // FuzzyConfig fuzzyConfig = config.Get(ConfigurationKeys.FUZZY_CONFIG);
-
- // if (fuzzyConfig == null)
- // {
- // fuzzyConfig = new FuzzyConfig();
- // config.Set(ConfigurationKeys.FUZZY_CONFIG, fuzzyConfig);
- // }
-
- // fuzzyConfig.SetPrefixLength(fuzzyPrefixLength);
-
- //}
-
- //public virtual void SetNumericConfigMap(IDictionary<string, NumericConfig> numericConfigMap)
- //{
- // QueryConfigHandler.Set(ConfigurationKeys.NUMERIC_CONFIG_MAP, numericConfigMap);
- //}
-
public virtual IDictionary<string, NumericConfig> NumericConfigMap
{
get { return QueryConfigHandler.Get(ConfigurationKeys.NUMERIC_CONFIG_MAP); }
set { QueryConfigHandler.Set(ConfigurationKeys.NUMERIC_CONFIG_MAP, value); }
}
+ /// <summary>
+ /// Gets or Sets current locale, allowing access by subclasses. Used by date range parsing
+ /// </summary>
public virtual CultureInfo Locale
{
get
@@ -367,24 +249,6 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
}
}
- ///**
- // * Set locale used by date range parsing.
- // */
-
- //public override void SetLocale(CultureInfo locale)
- //{
- // GetQueryConfigHandler().Set(ConfigurationKeys.LOCALE, locale);
- //}
-
- ///**
- // * Returns current locale, allowing access by subclasses.
- // */
-
- //public override CultureInfo GetLocale()
- //{
- // return GetQueryConfigHandler().Get(ConfigurationKeys.LOCALE);
- //}
-
public virtual TimeZoneInfo TimeZone
{
get
@@ -397,39 +261,17 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
}
}
- //public override void SetTimeZone(TimeZoneInfo timeZone)
- //{
- // GetQueryConfigHandler().Set(ConfigurationKeys.TIMEZONE, timeZone);
- //}
-
-
- //public override TimeZoneInfo GetTimeZone()
- //{
- // return GetQueryConfigHandler().Get(ConfigurationKeys.TIMEZONE);
- //}
-
- /**
- * Sets the default slop for phrases. If zero, then exact phrase matches are
- * required. Default value is zero.
- *
- * @deprecated renamed to {@link #setPhraseSlop(int)}
- */
- [Obsolete]
+ /// <summary>
+ /// Sets the default slop for phrases. If zero, then exact phrase matches are
+ /// required. Default value is zero.
+ /// </summary>
+ /// <param name="defaultPhraseSlop"></param>
+ [Obsolete("Use PhraseSlop property setter instead.")]
public virtual void SetDefaultPhraseSlop(int defaultPhraseSlop)
{
QueryConfigHandler.Set(ConfigurationKeys.PHRASE_SLOP, defaultPhraseSlop);
}
- ///**
- // * Sets the default slop for phrases. If zero, then exact phrase matches are
- // * required. Default value is zero.
- // */
- //[Obsolete]
- //public void SetPhraseSlop(int defaultPhraseSlop)
- //{
- // GetQueryConfigHandler().Set(ConfigurationKeys.PHRASE_SLOP, defaultPhraseSlop);
- //}
-
public virtual Analyzer Analyzer
{
get
@@ -442,65 +284,10 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
}
}
- //public void SetAnalyzer(Analyzer analyzer)
- //{
- // GetQueryConfigHandler().Set(ConfigurationKeys.ANALYZER, analyzer);
- //}
-
- //public override Analyzer GetAnalyzer()
- //{
- // return GetQueryConfigHandler().Get(ConfigurationKeys.ANALYZER);
- //}
-
- ///**
- // * @see #setAllowLeadingWildcard(boolean)
- // */
-
- //public override bool GetAllowLeadingWildcard()
- //{
- // bool? allowLeadingWildcard = GetQueryConfigHandler().Get(ConfigurationKeys.ALLOW_LEADING_WILDCARD);
-
- // if (allowLeadingWildcard == null)
- // {
- // return false;
-
- // }
- // else
- // {
- // return allowLeadingWildcard.Value;
- // }
- //}
-
- /**
- * Get the minimal similarity for fuzzy queries.
- */
-
- //public override float GetFuzzyMinSim()
- //{
- // FuzzyConfig fuzzyConfig = GetQueryConfigHandler().Get(ConfigurationKeys.FUZZY_CONFIG);
- // return (fuzzyConfig != null) ? fuzzyConfig.GetMinSimilarity() : FuzzyQuery.DefaultMinSimilarity;
- //}
-
- ///**
- // * Get the prefix length for fuzzy queries.
- // *
- // * @return Returns the fuzzyPrefixLength.
- // */
-
- //public override int GetFuzzyPrefixLength()
- //{
- // FuzzyConfig fuzzyConfig = GetQueryConfigHandler().Get(ConfigurationKeys.FUZZY_CONFIG);
-
- // if (fuzzyConfig == null)
- // {
- // return FuzzyQuery.DefaultPrefixLength;
- // }
- // else
- // {
- // return fuzzyConfig.GetPrefixLength();
- // }
- //}
-
+ /// <summary>
+ /// Gets the default slop for phrases. If zero, then exact phrase matches are
+ /// required. Default value is zero. NOTE: Setter is deprecated.
+ /// </summary>
public virtual int PhraseSlop
{
get
@@ -508,31 +295,16 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
int? phraseSlop = QueryConfigHandler.Get(ConfigurationKeys.PHRASE_SLOP);
return phraseSlop.HasValue ? phraseSlop.Value : 0;
}
- set // LUCENENET TODO: obsolete
+ set
{
QueryConfigHandler.Set(ConfigurationKeys.PHRASE_SLOP, value);
}
}
- ///**
- // * Gets the default slop for phrases.
- // */
-
- //public override int GetPhraseSlop()
- //{
- // int? phraseSlop = GetQueryConfigHandler().Get(ConfigurationKeys.PHRASE_SLOP);
-
- // if (phraseSlop == null)
- // {
- // return 0;
-
- // }
- // else
- // {
- // return phraseSlop.Value;
- // }
- //}
-
+ /// <summary>
+ /// Gets or Sets the minimum similarity for fuzzy queries. Default is defined on
+ /// <see cref="FuzzyQuery.DefaultMinSimilarity"/>.
+ /// </summary>
public virtual float FuzzyMinSim
{
get
@@ -555,101 +327,52 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
}
}
- ///**
- // * Set the minimum similarity for fuzzy queries. Default is defined on
- // * {@link FuzzyQuery#defaultMinSimilarity}.
- // */
-
- //public override void SetFuzzyMinSim(float fuzzyMinSim)
- //{
- // QueryConfigHandler config = GetQueryConfigHandler();
- // FuzzyConfig fuzzyConfig = config.Get(ConfigurationKeys.FUZZY_CONFIG);
-
- // if (fuzzyConfig == null)
- // {
- // fuzzyConfig = new FuzzyConfig();
- // config.Set(ConfigurationKeys.FUZZY_CONFIG, fuzzyConfig);
- // }
-
- // fuzzyConfig.SetMinSimilarity(fuzzyMinSim);
- //}
-
- ///**
- // * Sets the boost used for each field.
- // *
- // * @param boosts a collection that maps a field to its boost
- // */
- //public virtual void SetFieldsBoost(IDictionary<string, float?> boosts)
- //{
- // QueryConfigHandler.Set(ConfigurationKeys.FIELD_BOOST_MAP, boosts);
- //}
-
- /**
- * Returns the field to boost map used to set boost for each field.
- *
- * @return the field to boost map
- */
+ /// <summary>
+ /// Gets or Sets the field to boost map used to set boost for each field.
+ /// </summary>
public virtual IDictionary<string, float?> FieldsBoost
{
get { return QueryConfigHandler.Get(ConfigurationKeys.FIELD_BOOST_MAP); }
set { QueryConfigHandler.Set(ConfigurationKeys.FIELD_BOOST_MAP, value); }
}
- ///**
- // * Sets the default {@link Resolution} used for certain field when
- // * no {@link Resolution} is defined for this field.
- // *
- // * @param dateResolution the default {@link Resolution}
- // */
-
+ /// <summary>
+ /// Sets the default <see cref="DateTools.Resolution"/> used for certain field when
+ /// no <see cref="DateTools.Resolution"/> is defined for this field.
+ /// </summary>
+ /// <param name="dateResolution">the default <see cref="DateTools.Resolution"/></param>
+ // LUCENENET NOTE: This method is required by the ICommonQueryParserConfiguration interface
public virtual void SetDateResolution(DateTools.Resolution dateResolution)
{
QueryConfigHandler.Set(ConfigurationKeys.DATE_RESOLUTION, dateResolution);
}
- /**
- * Returns the default {@link Resolution} used for certain field when
- * no {@link Resolution} is defined for this field.
- *
- * @return the default {@link Resolution}
- */
+ /// <summary>
+ /// Gets the default <see cref="DateTools.Resolution"/> used for certain field when
+ /// no <see cref="DateTools.Resolution"/> is defined for this field.
+ /// </summary>
public virtual DateTools.Resolution DateResolution
{
get { return QueryConfigHandler.Get(ConfigurationKeys.DATE_RESOLUTION); }
}
- /**
- * Sets the {@link Resolution} used for each field
- *
- * @param dateRes a collection that maps a field to its {@link Resolution}
- *
- * @deprecated this method was renamed to {@link #setDateResolutionMap(Map)}
- */
- [Obsolete]
+ /// <summary>
+ /// Sets the {@link Resolution} used for each field
+ /// </summary>
+ /// <param name="dateRes">a collection that maps a field to its <see cref="DateTools.Resolution"/></param>
+ [Obsolete("Use DateResolutionMap property instead.")]
public virtual void SetDateResolution(IDictionary<string, DateTools.Resolution?> dateRes)
{
DateResolutionMap = dateRes;
}
- /**
- * Returns the field to {@link Resolution} map used to normalize each date field.
- *
- * @return the field to {@link Resolution} map
- */
+ /// <summary>
+ /// Gets or Sets the field to <see cref="DateTools.Resolution?"/> map used to normalize each date field.
+ /// </summary>
public virtual IDictionary<string, DateTools.Resolution?> DateResolutionMap
{
get { return QueryConfigHandler.Get(ConfigurationKeys.FIELD_DATE_RESOLUTION_MAP); }
set { QueryConfigHandler.Set(ConfigurationKeys.FIELD_DATE_RESOLUTION_MAP, value); }
}
-
- ///**
- // * Sets the {@link Resolution} used for each field
- // *
- // * @param dateRes a collection that maps a field to its {@link Resolution}
- // */
- //public virtual void SetDateResolutionMap(IDictionary<string, DateTools.Resolution?> dateRes)
- //{
- // QueryConfigHandler.Set(ConfigurationKeys.FIELD_DATE_RESOLUTION_MAP, dateRes);
- //}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.Tests.QueryParser/Flexible/Messages/TestNLS.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Messages/TestNLS.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Messages/TestNLS.cs
index 841d3fb..090adce 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Messages/TestNLS.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Messages/TestNLS.cs
@@ -14,18 +14,12 @@ namespace Lucene.Net.QueryParsers.Flexible.Messages
[Test]
public void TestMessageLoading()
{
- //string message = MessagesTestBundle.ResourceManager.GetString("Q0001E_INVALID_SYNTAX");
-
- //fail("not implemented");
-
IMessage invalidSyntax = new MessageImpl(
MessagesTestBundle.Q0001E_INVALID_SYNTAX, "XXX");
/*
* if the default locale is ja, you get ja as a fallback:
* see ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)
*/
- //if (!Locale.getDefault().getLanguage().equals("ja"))
- // assertEquals("Syntax Error: XXX", invalidSyntax.getLocalizedMessage(Locale.ENGLISH));
if (!CultureInfo.CurrentUICulture.Equals(new CultureInfo("ja")))
assertEquals("Syntax Error: XXX", invalidSyntax.GetLocalizedMessage(new CultureInfo("en")));
}
@@ -48,7 +42,6 @@ namespace Lucene.Net.QueryParsers.Flexible.Messages
* if the default locale is ja, you get ja as a fallback:
* see ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)
*/
- //if (!Locale.getDefault().getLanguage().equals("ja"))
if (!CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.Equals("ja", StringComparison.OrdinalIgnoreCase))
assertEquals("Truncated unicode escape sequence.", message);
@@ -58,8 +51,6 @@ namespace Lucene.Net.QueryParsers.Flexible.Messages
* if the default locale is ja, you get ja as a fallback:
* see ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)
*/
- //if (!Locale.getDefault().getLanguage().equals("ja"))
- //if (!CultureInfo.CurrentUICulture.Equals(new CultureInfo("ja-JP")))
if (!CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.Equals("ja", StringComparison.OrdinalIgnoreCase))
assertEquals("Syntax Error: XXX", message);
}
@@ -80,7 +71,6 @@ namespace Lucene.Net.QueryParsers.Flexible.Messages
[Test]
public void TestNLSLoading_xx_XX()
{
- //Locale locale = new Locale("xx", "XX", "");
CultureInfo locale = new CultureInfo("xx-XX");
String message = NLS.GetLocalizedMessage(
MessagesTestBundle.Q0004E_INVALID_SYNTAX_ESCAPE_UNICODE_TRUNCATION,
@@ -89,7 +79,6 @@ namespace Lucene.Net.QueryParsers.Flexible.Messages
* if the default locale is ja, you get ja as a fallback:
* see ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)
*/
- //if (!Locale.getDefault().getLanguage().equals("ja"))
if (!CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.Equals("ja", StringComparison.OrdinalIgnoreCase))
assertEquals("Truncated unicode escape sequence.", message);
@@ -99,17 +88,13 @@ namespace Lucene.Net.QueryParsers.Flexible.Messages
* if the default locale is ja, you get ja as a fallback:
* see ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)
*/
- //if (!Locale.getDefault().getLanguage().equals("ja"))
if (!CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.Equals("ja", StringComparison.OrdinalIgnoreCase))
assertEquals("Syntax Error: XXX", message);
}
- // LUCENENET TODO: This doesn't compile because the resources don't contain this message
-
[Test]
public void TestMissingMessage()
{
- //Locale locale = Locale.ENGLISH;
CultureInfo locale = new CultureInfo("en");
String message = NLS.GetLocalizedMessage(
MessagesTestBundle.Q0005E_MESSAGE_NOT_IN_BUNDLE, locale);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/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 19b8e02..aa1f48d 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpanOrQueryNodeBuilder.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpanOrQueryNodeBuilder.cs
@@ -12,15 +12,14 @@ using System.Threading.Tasks;
namespace Lucene.Net.QueryParsers.Flexible.Spans
{
/// <summary>
- /// This builder creates {@link SpanOrQuery}s from a {@link BooleanQueryNode}.
+ /// This builder creates <see cref="SpanOrQuery"/>s from a <see cref="BooleanQueryNode"/>.
/// <para/>
- /// It assumes that the {@link BooleanQueryNode} instance has at least one child.
+ /// It assumes that the <see cref="BooleanQueryNode"/> instance has at least one child.
/// </summary>
public class SpanOrQueryNodeBuilder : IStandardQueryBuilder
{
public virtual Query Build(IQueryNode node)
{
-
// validates node
BooleanQueryNode booleanNode = (BooleanQueryNode)node;
@@ -38,13 +37,5 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
return new SpanOrQuery(spanQueries);
}
-
- ///// <summary>
- ///// LUCENENET specific overload for supporting IQueryBuilder
- ///// </summary>
- //object IQueryBuilder.Build(IQueryNode queryNode)
- //{
- // return Build(queryNode);
- //}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpanTermQueryNodeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpanTermQueryNodeBuilder.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpanTermQueryNodeBuilder.cs
index cbaf27f..68870e8 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpanTermQueryNodeBuilder.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpanTermQueryNodeBuilder.cs
@@ -13,28 +13,17 @@ using System.Threading.Tasks;
namespace Lucene.Net.QueryParsers.Flexible.Spans
{
/// <summary>
- /// This builder creates {@link SpanTermQuery}s from a {@link FieldQueryNode}
+ /// This builder creates <see cref="SpanTermQuery"/>s from a <see cref="FieldQueryNode"/>
/// object.
/// </summary>
public class SpanTermQueryNodeBuilder : IStandardQueryBuilder
{
-
public virtual Query Build(IQueryNode node)
{
FieldQueryNode fieldQueryNode = (FieldQueryNode)node;
return new SpanTermQuery(new Term(fieldQueryNode.GetFieldAsString(),
fieldQueryNode.GetTextAsString()));
-
}
-
- ///// <summary>
- ///// LUCENENET specific overload for supporting IQueryBuilder
- ///// </summary>
- //object IQueryBuilder.Build(IQueryNode queryNode)
- //{
- // return Build(queryNode);
- //}
-
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpansQueryConfigHandler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpansQueryConfigHandler.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpansQueryConfigHandler.cs
index a5b8f7a..5f034ac 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpansQueryConfigHandler.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpansQueryConfigHandler.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace Lucene.Net.QueryParsers.Flexible.Spans
{
/// <summary>
- /// This query config handler only adds the {@link UniqueFieldAttribute} to it.
+ /// This query config handler only adds the <see cref="IUniqueFieldAttribute"/> to it.
/// <para/>
/// It does not return any configuration for a field in specific.
/// </summary>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpansQueryTreeBuilder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpansQueryTreeBuilder.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpansQueryTreeBuilder.cs
index 1f63e97..4d6fd30 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpansQueryTreeBuilder.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpansQueryTreeBuilder.cs
@@ -31,18 +31,5 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
{
return base.Build(queryTree);
}
-
- //Query IStandardQueryBuilder.Build(IQueryNode queryTree)
- //{
- // return (Query)base.Build(queryTree);
- //}
-
- ///// <summary>
- ///// LUCENENET specific overload for supporting IQueryBuilder
- ///// </summary>
- //public override object Build(IQueryNode queryTree)
- //{
- // return (Query)base.Build(queryTree);
- //}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpansValidatorQueryNodeProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpansValidatorQueryNodeProcessor.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpansValidatorQueryNodeProcessor.cs
index c44c1f5..4086679 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpansValidatorQueryNodeProcessor.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/SpansValidatorQueryNodeProcessor.cs
@@ -13,26 +13,22 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
{
/// <summary>
/// Validates every query node in a query node tree. This processor will pass
- /// fine if the query nodes are only {@link BooleanQueryNode}s,
- /// {@link OrQueryNode}s or {@link FieldQueryNode}s, otherwise an exception will
+ /// fine if the query nodes are only <see cref="BooleanQueryNode"/>s,
+ /// <see cref="OrQueryNode"/>s or <see cref="FieldQueryNode"/>s, otherwise an exception will
/// be thrown.
/// <para/>
- /// If they are {@link AndQueryNode} or an instance of anything else that
- /// implements {@link FieldQueryNode} the exception will also be thrown.
+ /// If they are <see cref="AndQueryNode"/> or an instance of anything else that
+ /// implements <see cref="FieldQueryNode"/> the exception will also be thrown.
/// </summary>
public class SpansValidatorQueryNodeProcessor : QueryNodeProcessorImpl
{
protected override IQueryNode PostProcessNode(IQueryNode node)
{
-
return node;
-
}
-
protected override IQueryNode PreProcessNode(IQueryNode node)
{
-
if (!((node is BooleanQueryNode && !(node is AndQueryNode)) || node
.GetType() == typeof(FieldQueryNode)))
{
@@ -41,15 +37,11 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
}
return node;
-
}
-
protected override IList<IQueryNode> SetChildrenOrder(IList<IQueryNode> children)
{
-
return children;
-
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParser.cs
index a59da48..a9ca6aa 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParser.cs
@@ -20,14 +20,14 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
/// <para/>
/// It tests queries likes "term", "field:term" "term1 term2" "term1 OR term2",
/// which are all already supported by the current syntax parser (
- /// {@link StandardSyntaxParser}).
+ /// <see cref="StandardSyntaxParser"/>).
/// <para/>
/// The goals is to create a new query parser that supports only the pair
/// "field:term" or a list of pairs separated or not by an OR operator, and from
- /// this query generate {@link SpanQuery} objects instead of the regular
- /// {@link Query} objects. Basically, every pair will be converted to a
- /// {@link SpanTermQuery} object and if there are more than one pair they will be
- /// grouped by an {@link OrQueryNode}.
+ /// this query generate <see cref="SpanQuery"/> objects instead of the regular
+ /// <see cref="Search.Query"/> objects. Basically, every pair will be converted to a
+ /// <see cref="SpanTermQuery"/> object and if there are more than one pair they will be
+ /// grouped by an <see cref="OrQueryNode"/>.
/// <para/>
/// Another functionality that will be added is the ability to convert every
/// field defined in the query to an unique specific field.
@@ -36,28 +36,28 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
/// processing (semantic) and building.
/// <para/>
/// The parsing phase, as already mentioned will be performed by the current
- /// query parser: {@link StandardSyntaxParser}.
+ /// query parser: <see cref="StandardSyntaxParser"/>.
/// <para/>
/// The processing phase will be performed by a processor pipeline which is
- /// compound by 2 processors: {@link SpansValidatorQueryNodeProcessor} and
- /// {@link UniqueFieldQueryNodeProcessor}.
+ /// compound by 2 processors: <see cref="SpansValidatorQueryNodeProcessor"/> and
+ /// <see cref="UniqueFieldQueryNodeProcessor"/>.
/// <para/>
///
- /// {@link SpansValidatorQueryNodeProcessor}: as it's going to use the current
+ /// <see cref="SpansValidatorQueryNodeProcessor"/>: as it's going to use the current
/// query parser to parse the syntax, it will support more features than we want,
/// this processor basically validates the query node tree generated by the parser
/// and just let got through the elements we want, all the other elements as
/// wildcards, range queries, etc...if found, an exception is thrown.
///
- /// {@link UniqueFieldQueryNodeProcessor}: this processor will take care of reading
+ /// <see cref="UniqueFieldQueryNodeProcessor"/>: this processor will take care of reading
/// what is the "unique field" from the configuration and convert every field defined
- /// in every pair to this "unique field". For that, a {@link SpansQueryConfigHandler} is
- /// used, which has the {@link UniqueFieldAttribute} defined in it.
+ /// in every pair to this "unique field". For that, a <see cref="SpansQueryConfigHandler"/> is
+ /// used, which has the <see cref="IUniqueFieldAttribute"/> defined in it.
///
/// <para/>
- /// The building phase is performed by the {@link SpansQueryTreeBuilder}, which
+ /// The building phase is performed by the <see cref="SpansQueryTreeBuilder"/>, which
/// basically contains a map that defines which builder will be used to generate
- /// {@link SpanQuery} objects from {@link QueryNode} objects.
+ /// <see cref="SpanQuery"/> objects from <see cref="IQueryNode"/> objects.
/// </summary>
/// <seealso cref="SpansQueryConfigHandler"/>
/// <seealso cref="SpansQueryTreeBuilder"/>
@@ -232,7 +232,6 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
{
// expected exception
}
-
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParserSimpleSample.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParserSimpleSample.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParserSimpleSample.cs
index 5b40f51..75bb404 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParserSimpleSample.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/TestSpanQueryParserSimpleSample.cs
@@ -19,14 +19,14 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
/// <para/>
/// It tests queries likes "term", "field:term" "term1 term2" "term1 OR term2",
/// which are all already supported by the current syntax parser (
- /// {@link StandardSyntaxParser}).
+ /// <see cref="StandardSyntaxParser"/>).
/// <para/>
/// The goals is to create a new query parser that supports only the pair
/// "field:term" or a list of pairs separated or not by an OR operator, and from
- /// this query generate {@link SpanQuery} objects instead of the regular
- /// {@link Query} objects. Basically, every pair will be converted to a
- /// {@link SpanTermQuery} object and if there are more than one pair they will be
- /// grouped by an {@link OrQueryNode}.
+ /// this query generate <see cref="SpanQuery"/> objects instead of the regular
+ /// <see cref="Search.Query"/> objects. Basically, every pair will be converted to a
+ /// <see cref="SpanTermQuery"/> object and if there are more than one pair they will be
+ /// grouped by an <see cref="OrQueryNode"/>.
/// <para/>
/// Another functionality that will be added is the ability to convert every
/// field defined in the query to an unique specific field.
@@ -35,26 +35,26 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
/// processing (semantic) and building.
/// <para/>
/// The parsing phase, as already mentioned will be performed by the current
- /// query parser: {@link StandardSyntaxParser}.
+ /// query parser: <see cref="StandardSyntaxParser"/>.
/// <para/>
/// The processing phase will be performed by a processor pipeline which is
- /// compound by 2 processors: {@link SpansValidatorQueryNodeProcessor} and
- /// {@link UniqueFieldQueryNodeProcessor}.
+ /// compound by 2 processors: <see cref="SpansValidatorQueryNodeProcessor"/> and
+ /// <see cref="UniqueFieldQueryNodeProcessor"/>.
/// <para/>
- /// {@link SpansValidatorQueryNodeProcessor}: as it's going to use the current
+ /// <see cref="SpansValidatorQueryNodeProcessor"/>: as it's going to use the current
/// query parser to parse the syntax, it will support more features than we want,
/// this processor basically validates the query node tree generated by the parser
/// and just let got through the elements we want, all the other elements as
/// wildcards, range queries, etc...if found, an exception is thrown.
/// <para/>
- /// {@link UniqueFieldQueryNodeProcessor}: this processor will take care of reading
+ /// <see cref="UniqueFieldQueryNodeProcessor"/>: this processor will take care of reading
/// what is the "unique field" from the configuration and convert every field defined
- /// in every pair to this "unique field". For that, a {@link SpansQueryConfigHandler} is
- /// used, which has the {@link UniqueFieldAttribute} defined in it.
+ /// in every pair to this "unique field". For that, a <see cref="SpansQueryConfigHandler"/> is
+ /// used, which has the <see cref="IUniqueFieldAttribute"/> defined in it.
/// <para/>
- /// The building phase is performed by the {@link SpansQueryTreeBuilder}, which
+ /// The building phase is performed by the <see cref="SpansQueryTreeBuilder"/>, which
/// basically contains a map that defines which builder will be used to generate
- /// {@link SpanQuery} objects from {@link QueryNode} objects.
+ /// <see cref="SpanQuery"/> objects from <see cref="IQueryNode"/> objects.
/// </summary>
/// <seealso cref="TestSpanQueryParser">for a more advanced example</seealso>
///
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/UniqueFieldAttribute.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/UniqueFieldAttribute.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/UniqueFieldAttribute.cs
index 67b9a8a..90cb2ac 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/UniqueFieldAttribute.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/UniqueFieldAttribute.cs
@@ -8,9 +8,9 @@ using System.Threading.Tasks;
namespace Lucene.Net.QueryParsers.Flexible.Spans
{
/// <summary>
- /// This attribute is used by the {@link UniqueFieldQueryNodeProcessor}
+ /// This attribute is used by the <see cref="UniqueFieldQueryNodeProcessor"/>
/// processor. It holds a value that defines which is the unique field name that
- /// should be set in every {@link FieldableNode}.
+ /// should be set in every <see cref="Core.Nodes.IFieldableNode"/>.
/// </summary>
/// <seealso cref="UniqueFieldQueryNodeProcessor"/>
public interface IUniqueFieldAttribute : IAttribute
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/UniqueFieldAttributeImpl.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/UniqueFieldAttributeImpl.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/UniqueFieldAttributeImpl.cs
index 23d3745..b8e63a8 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/UniqueFieldAttributeImpl.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/UniqueFieldAttributeImpl.cs
@@ -1,5 +1,4 @@
-\ufeff//using System;
-using Lucene.Net.Util;
+\ufeffusing Lucene.Net.Util;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,9 +7,9 @@ using System.Threading.Tasks;
namespace Lucene.Net.QueryParsers.Flexible.Spans
{
/// <summary>
- /// This attribute is used by the {@link UniqueFieldQueryNodeProcessor}
+ /// This attribute is used by the <see cref="UniqueFieldQueryNodeProcessor"/>
/// processor. It holds a value that defines which is the unique field name that
- /// should be set in every {@link FieldableNode}.
+ /// should be set in every <see cref="Core.Nodes.IFieldableNode"/>.
/// </summary>
/// <seealso cref="UniqueFieldQueryNodeProcessor"/>
public class UniqueFieldAttributeImpl : AttributeImpl, IUniqueFieldAttribute
@@ -22,20 +21,17 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
Clear();
}
-
public override void Clear()
{
this.uniqueField = "";
}
-
public virtual string UniqueField
{
get { return this.uniqueField; }
set { this.uniqueField = value; }
}
-
public override void CopyTo(Attribute target)
{
@@ -48,36 +44,28 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
UniqueFieldAttributeImpl uniqueFieldAttr = (UniqueFieldAttributeImpl)target;
uniqueFieldAttr.uniqueField = uniqueField.toString();
-
}
-
public override bool Equals(object other)
{
-
if (other is UniqueFieldAttributeImpl)
{
return ((UniqueFieldAttributeImpl)other).uniqueField
.equals(this.uniqueField);
-
}
return false;
-
}
-
public override int GetHashCode()
{
return this.uniqueField.GetHashCode();
}
-
public override string ToString()
{
return "<uniqueField uniqueField='" + this.uniqueField + "'/>";
}
-
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8e1931b9/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/UniqueFieldQueryNodeProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/UniqueFieldQueryNodeProcessor.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/UniqueFieldQueryNodeProcessor.cs
index 11230b8..5b80585 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/UniqueFieldQueryNodeProcessor.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Spans/UniqueFieldQueryNodeProcessor.cs
@@ -10,26 +10,22 @@ using System.Threading.Tasks;
namespace Lucene.Net.QueryParsers.Flexible.Spans
{
/// <summary>
- /// This processor changes every field name of each {@link FieldableNode} query
+ /// This processor changes every field name of each <see cref="IFieldableNode"/> query
/// node contained in the query tree to the field name defined in the
- /// {@link UniqueFieldAttribute}. So, the {@link UniqueFieldAttribute} must be
- /// defined in the {@link QueryConfigHandler} object set in this processor,
+ /// <see cref="IUniqueFieldAttribute"/>. So, the <see cref="IUniqueFieldAttribute"/> must be
+ /// defined in the <see cref="QueryConfigHandler"/> object set in this processor,
/// otherwise it throws an exception.
/// </summary>
- /// <seealso cref="UniqueFieldAttribute"/>
+ /// <seealso cref="IUniqueFieldAttribute"/>
public class UniqueFieldQueryNodeProcessor : QueryNodeProcessorImpl
{
protected override IQueryNode PostProcessNode(IQueryNode node)
{
-
return node;
-
}
-
protected override IQueryNode PreProcessNode(IQueryNode node)
{
-
if (node is IFieldableNode)
{
IFieldableNode fieldNode = (IFieldableNode)node;
@@ -50,19 +46,14 @@ namespace Lucene.Net.QueryParsers.Flexible.Spans
String uniqueField = queryConfig.Get(SpansQueryConfigHandler.UNIQUE_FIELD);
fieldNode.Field = (uniqueField);
-
}
return node;
-
}
-
protected override IList<IQueryNode> SetChildrenOrder(IList<IQueryNode> children)
{
-
return children;
-
}
}
}