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 2017/01/26 11:12:14 UTC
[01/11] lucenenet git commit:
Lucene.Net.QueryParser.Flexible.Core.Processors.QueryNodeProcessor: Added
TODO about changing NullReferenceException to ArgumentException
Repository: lucenenet
Updated Branches:
refs/heads/api-work 726c43f04 -> 8174a11cc
Lucene.Net.QueryParser.Flexible.Core.Processors.QueryNodeProcessor: Added TODO about changing NullReferenceException to ArgumentException
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/332b24c4
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/332b24c4
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/332b24c4
Branch: refs/heads/api-work
Commit: 332b24c437a6ac14224bd32ce50fd83530b0c5a5
Parents: 726c43f
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Jan 26 14:05:54 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Jan 26 14:05:54 2017 +0700
----------------------------------------------------------------------
.../Flexible/Core/Processors/QueryNodeProcessorImpl.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/332b24c4/src/Lucene.Net.QueryParser/Flexible/Core/Processors/QueryNodeProcessorImpl.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Core/Processors/QueryNodeProcessorImpl.cs b/src/Lucene.Net.QueryParser/Flexible/Core/Processors/QueryNodeProcessorImpl.cs
index feb3d26..e7b678a 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Core/Processors/QueryNodeProcessorImpl.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Core/Processors/QueryNodeProcessorImpl.cs
@@ -119,7 +119,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Core.Processors
if (child2 == null)
{
- throw new NullReferenceException();
+ throw new NullReferenceException(); // LUCENENET TODO: Change to ArgumentException ?
}
[05/11] lucenenet git commit: Lucene.Net.Expressions.Expression
refactor: Changed sourceText and variables to properties and renamed
PascalCase. Added WritableArray attribute to Variables.
Posted by ni...@apache.org.
Lucene.Net.Expressions.Expression refactor: Changed sourceText and variables to properties and renamed PascalCase. Added WritableArray attribute to Variables.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/c79c9eb7
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/c79c9eb7
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/c79c9eb7
Branch: refs/heads/api-work
Commit: c79c9eb78faa93e622a78f0607d498c45719bdbb
Parents: 8ade0b4
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Jan 26 15:45:00 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Jan 26 15:45:00 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Expressions/Expression.cs | 12 +++++++-----
src/Lucene.Net.Expressions/ExpressionRescorer.cs | 2 +-
src/Lucene.Net.Expressions/ExpressionValueSource.cs | 14 +++++++-------
3 files changed, 15 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c79c9eb7/src/Lucene.Net.Expressions/Expression.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/Expression.cs b/src/Lucene.Net.Expressions/Expression.cs
index 88ef269..7189e6d 100644
--- a/src/Lucene.Net.Expressions/Expression.cs
+++ b/src/Lucene.Net.Expressions/Expression.cs
@@ -1,5 +1,6 @@
using Lucene.Net.Queries.Function;
using Lucene.Net.Search;
+using Lucene.Net.Support;
namespace Lucene.Net.Expressions
{
@@ -43,10 +44,11 @@ namespace Lucene.Net.Expressions
public abstract class Expression
{
/// <summary>The original source text</summary>
- public readonly string sourceText; // LUCENENET TODO: Make property
+ public string SourceText { get; private set; }
/// <summary>Named variables referred to by this expression</summary>
- public readonly string[] variables; // LUCENENET TODO: Make property
+ [WritableArray]
+ public string[] Variables { get; private set; }
/// <summary>
/// Creates a new <see cref="Expression"/>.
@@ -61,8 +63,8 @@ namespace Lucene.Net.Expressions
protected Expression(string sourceText, string[] variables)
{
// javadocs
- this.sourceText = sourceText;
- this.variables = variables;
+ this.SourceText = sourceText;
+ this.Variables = variables;
}
/// <summary>Evaluates the expression for the given document.</summary>
@@ -70,7 +72,7 @@ namespace Lucene.Net.Expressions
/// <param name="document"><c>docId</c> of the document to compute a value for</param>
/// <param name="functionValues">
/// <see cref="Lucene.Net.Queries.Function.FunctionValues"/>
- /// for each element of <see cref="variables">variables</see>.
+ /// for each element of <see cref="Variables">variables</see>.
/// </param>
/// <returns>The computed value of the expression for the given document.</returns>
public abstract double Evaluate(int document, FunctionValues[] functionValues);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c79c9eb7/src/Lucene.Net.Expressions/ExpressionRescorer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ExpressionRescorer.cs b/src/Lucene.Net.Expressions/ExpressionRescorer.cs
index bd3de3e..ffed9e5 100644
--- a/src/Lucene.Net.Expressions/ExpressionRescorer.cs
+++ b/src/Lucene.Net.Expressions/ExpressionRescorer.cs
@@ -111,7 +111,7 @@ namespace Lucene.Net.Expressions
var context = new Dictionary<string, object>();
var fakeScorer = new FakeScorer { score = firstPassExplanation.Value, doc = docIDInSegment };
context["scorer"] = fakeScorer;
- foreach (string variable in expression.variables)
+ foreach (string variable in expression.Variables)
{
result.AddDetail(new Explanation((float)bindings.GetValueSource(variable).GetValues
(context, readerContext).DoubleVal(docIDInSegment), "variable \"" + variable + "\""
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c79c9eb7/src/Lucene.Net.Expressions/ExpressionValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ExpressionValueSource.cs b/src/Lucene.Net.Expressions/ExpressionValueSource.cs
index 897b5bc..85ec736 100644
--- a/src/Lucene.Net.Expressions/ExpressionValueSource.cs
+++ b/src/Lucene.Net.Expressions/ExpressionValueSource.cs
@@ -46,11 +46,11 @@ namespace Lucene.Net.Expressions
throw new ArgumentNullException();
}
this.expression = expression;
- variables = new ValueSource[expression.variables.Length];
+ variables = new ValueSource[expression.Variables.Length];
bool needsScores = false;
for (int i = 0; i < variables.Length; i++)
{
- ValueSource source = bindings.GetValueSource(expression.variables[i]);
+ ValueSource source = bindings.GetValueSource(expression.Variables[i]);
if (source is ScoreValueSource)
{
needsScores = true;
@@ -69,7 +69,7 @@ namespace Lucene.Net.Expressions
{
if (source == null)
{
- throw new InvalidOperationException("Internal error. Variable (" + expression.variables[i]
+ throw new InvalidOperationException("Internal error. Variable (" + expression.Variables[i]
+ ") does not exist.");
}
}
@@ -88,10 +88,10 @@ namespace Lucene.Net.Expressions
context = new Hashtable(context);
context["valuesCache"] = valuesCache;
}
- FunctionValues[] externalValues = new FunctionValues[expression.variables.Length];
+ FunctionValues[] externalValues = new FunctionValues[expression.Variables.Length];
for (int i = 0; i < variables.Length; ++i)
{
- string externalName = expression.variables[i];
+ string externalName = expression.Variables[i];
FunctionValues values;
if (!valuesCache.TryGetValue(externalName,out values))
{
@@ -109,12 +109,12 @@ namespace Lucene.Net.Expressions
public override SortField GetSortField(bool reverse)
{
- return new ExpressionSortField(expression.sourceText, this, reverse);
+ return new ExpressionSortField(expression.SourceText, this, reverse);
}
public override string GetDescription()
{
- return "expr(" + expression.sourceText + ")";
+ return "expr(" + expression.SourceText + ")";
}
public override int GetHashCode()
[08/11] lucenenet git commit: Lucene.Net.Core.Store.IOContext: BUG -
changed position of DEFAULT label in UsageContext enum to the top because it
had the same value as MERGE when set explicitly
Posted by ni...@apache.org.
Lucene.Net.Core.Store.IOContext: BUG - changed position of DEFAULT label in UsageContext enum to the top because it had the same value as MERGE when set explicitly
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/dbe66cc4
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/dbe66cc4
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/dbe66cc4
Branch: refs/heads/api-work
Commit: dbe66cc48ae24481e0504c996d87c5c62a994143
Parents: 8d6b6c9
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Jan 26 16:50:00 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Jan 26 16:50:00 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Store/IOContext.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/dbe66cc4/src/Lucene.Net.Core/Store/IOContext.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/IOContext.cs b/src/Lucene.Net.Core/Store/IOContext.cs
index 8573544..1180c5b 100644
--- a/src/Lucene.Net.Core/Store/IOContext.cs
+++ b/src/Lucene.Net.Core/Store/IOContext.cs
@@ -35,10 +35,10 @@ namespace Lucene.Net.Store
/// </summary>
public enum UsageContext
{
+ DEFAULT = 0, // LUCENENET NOTE: 0 is the default for any value type, so when not initialized, this is the value we get
MERGE,
READ,
- FLUSH,
- DEFAULT = 0 // LUCENENET NOTE: 0 is the default for any value type, so when not initialized, this is the value we get
+ FLUSH
}
/// <summary>
[02/11] lucenenet git commit: Lucene.Net.Expressions: member
accessibility
Posted by ni...@apache.org.
Lucene.Net.Expressions: member accessibility
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/0d5490e8
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/0d5490e8
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/0d5490e8
Branch: refs/heads/api-work
Commit: 0d5490e819484e2ea34ed9729abf7227d648c083
Parents: 332b24c
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Jan 26 14:32:17 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Jan 26 14:32:17 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Expressions/Bindings.cs | 4 +--
src/Lucene.Net.Expressions/Expression.cs | 32 ++++++++++----------
.../ExpressionComparator.cs | 8 -----
.../ExpressionFunctionValues.cs | 6 ++--
.../ExpressionRescorer.cs | 10 ++----
.../ExpressionSortField.cs | 5 ++-
.../ExpressionValueSource.cs | 9 ++----
.../JS/JavascriptCompiler.cs | 22 ++------------
.../JS/JavascriptLexer.cs | 11 ++++---
.../JS/JavascriptParser.cs | 18 +++++------
.../Lucene.Net.Expressions.csproj | 2 +-
.../ScoreFunctionValues.cs | 1 +
src/Lucene.Net.Expressions/ScoreValueSource.cs | 9 ++----
src/Lucene.Net.Expressions/SimpleBindings.cs | 12 +++++---
14 files changed, 56 insertions(+), 93 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0d5490e8/src/Lucene.Net.Expressions/Bindings.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/Bindings.cs b/src/Lucene.Net.Expressions/Bindings.cs
index c299f15..59f12de 100644
--- a/src/Lucene.Net.Expressions/Bindings.cs
+++ b/src/Lucene.Net.Expressions/Bindings.cs
@@ -17,7 +17,7 @@ namespace Lucene.Net.Expressions
/// Sole constructor. (For invocation by subclass
/// constructors, typically implicit.)
/// </remarks>
- public Bindings()
+ protected Bindings()
{
}
@@ -30,7 +30,7 @@ namespace Lucene.Net.Expressions
/// <code>ValueSource</code>
/// over relevance scores
/// </summary>
- protected internal ValueSource GetScoreValueSource()
+ protected ValueSource GetScoreValueSource()
{
return new ScoreValueSource();
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0d5490e8/src/Lucene.Net.Expressions/Expression.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/Expression.cs b/src/Lucene.Net.Expressions/Expression.cs
index cd33d92..3c40f4c 100644
--- a/src/Lucene.Net.Expressions/Expression.cs
+++ b/src/Lucene.Net.Expressions/Expression.cs
@@ -26,24 +26,24 @@ namespace Lucene.Net.Expressions
public abstract class Expression
{
/// <summary>The original source text</summary>
- public readonly string sourceText;
+ public readonly string sourceText; // LUCENENET TODO: Make property
- /// <summary>Named variables referred to by this expression</summary>
- public readonly string[] variables;
+ /// <summary>Named variables referred to by this expression</summary>
+ public readonly string[] variables; // LUCENENET TODO: Make property
- /// <summary>
- /// Creates a new
- /// <code>Expression</code>
- /// .
- /// </summary>
- /// <param name="sourceText">
- /// Source text for the expression: e.g.
- /// <code>ln(popularity)</code>
- /// </param>
- /// <param name="variables">
- /// Names of external variables referred to by the expression
- /// </param>
- public Expression(string sourceText, string[] variables)
+ /// <summary>
+ /// Creates a new
+ /// <code>Expression</code>
+ /// .
+ /// </summary>
+ /// <param name="sourceText">
+ /// Source text for the expression: e.g.
+ /// <code>ln(popularity)</code>
+ /// </param>
+ /// <param name="variables">
+ /// Names of external variables referred to by the expression
+ /// </param>
+ protected Expression(string sourceText, string[] variables)
{
// javadocs
this.sourceText = sourceText;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0d5490e8/src/Lucene.Net.Expressions/ExpressionComparator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ExpressionComparator.cs b/src/Lucene.Net.Expressions/ExpressionComparator.cs
index cae906b..2b22f76 100644
--- a/src/Lucene.Net.Expressions/ExpressionComparator.cs
+++ b/src/Lucene.Net.Expressions/ExpressionComparator.cs
@@ -13,15 +13,11 @@ namespace Lucene.Net.Expressions
internal class ExpressionComparer : FieldComparer<double>
{
private readonly double[] values;
-
private double bottom;
-
private double topValue;
private ValueSource source;
-
private FunctionValues scores;
-
private AtomicReaderContext readerContext;
public ExpressionComparer(ValueSource source, int numHits)
@@ -58,19 +54,16 @@ namespace Lucene.Net.Expressions
topValue = (double)value;
}
-
public override int CompareBottom(int doc)
{
return bottom.CompareTo(scores.DoubleVal(doc));
}
-
public override void Copy(int slot, int doc)
{
values[slot] = scores.DoubleVal(doc);
}
-
public override FieldComparer SetNextReader(AtomicReaderContext context)
{
this.readerContext = context;
@@ -83,7 +76,6 @@ namespace Lucene.Net.Expressions
get { return values[slot]; }
}
-
public override int CompareTop(int doc)
{
return topValue.CompareTo(scores.DoubleVal(doc));
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0d5490e8/src/Lucene.Net.Expressions/ExpressionFunctionValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ExpressionFunctionValues.cs b/src/Lucene.Net.Expressions/ExpressionFunctionValues.cs
index 63b8f67..93adf84 100644
--- a/src/Lucene.Net.Expressions/ExpressionFunctionValues.cs
+++ b/src/Lucene.Net.Expressions/ExpressionFunctionValues.cs
@@ -13,15 +13,13 @@ namespace Lucene.Net.Expressions
internal class ExpressionFunctionValues : DoubleDocValues
{
internal readonly Expression expression;
-
internal readonly FunctionValues[] functionValues;
internal int currentDocument = -1;
-
internal double currentValue;
- internal ExpressionFunctionValues(ValueSource parent, Expression expression, FunctionValues
- [] functionValues) : base(parent)
+ internal ExpressionFunctionValues(ValueSource parent, Expression expression, FunctionValues[] functionValues)
+ : base(parent)
{
if (expression == null)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0d5490e8/src/Lucene.Net.Expressions/ExpressionRescorer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ExpressionRescorer.cs b/src/Lucene.Net.Expressions/ExpressionRescorer.cs
index 9087d0a..aa8b249 100644
--- a/src/Lucene.Net.Expressions/ExpressionRescorer.cs
+++ b/src/Lucene.Net.Expressions/ExpressionRescorer.cs
@@ -25,7 +25,6 @@ namespace Lucene.Net.Expressions
internal class ExpressionRescorer : SortRescorer
{
private readonly Expression expression;
-
private readonly Bindings bindings;
/// <summary>
@@ -36,8 +35,7 @@ namespace Lucene.Net.Expressions
/// pass scores.
/// </summary>
public ExpressionRescorer(Expression expression, Bindings bindings)
- : base(new Sort
- (expression.GetSortField(bindings, true)))
+ : base(new Sort(expression.GetSortField(bindings, true)))
{
this.expression = expression;
this.bindings = bindings;
@@ -46,9 +44,7 @@ namespace Lucene.Net.Expressions
private class FakeScorer : Scorer
{
internal float score;
-
internal int doc = -1;
-
internal int freq = 1;
public FakeScorer()
@@ -58,7 +54,7 @@ namespace Lucene.Net.Expressions
public override int Advance(int target)
{
- throw new NotSupportedException("FakeScorer doesn't support advance(int)");
+ throw new NotSupportedException("FakeScorer doesn't support Advance(int)");
}
public override int DocID
@@ -73,7 +69,7 @@ namespace Lucene.Net.Expressions
public override int NextDoc()
{
- throw new NotSupportedException("FakeScorer doesn't support nextDoc()");
+ throw new NotSupportedException("FakeScorer doesn't support NextDoc()");
}
public override float GetScore()
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0d5490e8/src/Lucene.Net.Expressions/ExpressionSortField.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ExpressionSortField.cs b/src/Lucene.Net.Expressions/ExpressionSortField.cs
index 4f21176..0f1da11 100644
--- a/src/Lucene.Net.Expressions/ExpressionSortField.cs
+++ b/src/Lucene.Net.Expressions/ExpressionSortField.cs
@@ -13,13 +13,12 @@ namespace Lucene.Net.Expressions
{
private readonly ExpressionValueSource source;
- internal ExpressionSortField(string name, ExpressionValueSource source, bool reverse
- ) : base(name, SortFieldType.CUSTOM, reverse)
+ internal ExpressionSortField(string name, ExpressionValueSource source, bool reverse)
+ : base(name, SortFieldType.CUSTOM, reverse)
{
this.source = source;
}
-
public override FieldComparer GetComparer(int numHits, int sortPos)
{
return new ExpressionComparer(source, numHits);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0d5490e8/src/Lucene.Net.Expressions/ExpressionValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ExpressionValueSource.cs b/src/Lucene.Net.Expressions/ExpressionValueSource.cs
index 241efab..87d7d7c 100644
--- a/src/Lucene.Net.Expressions/ExpressionValueSource.cs
+++ b/src/Lucene.Net.Expressions/ExpressionValueSource.cs
@@ -21,9 +21,7 @@ namespace Lucene.Net.Expressions
internal sealed class ExpressionValueSource : ValueSource
{
internal readonly ValueSource[] variables;
-
internal readonly Expression expression;
-
internal readonly bool needsScores;
internal ExpressionValueSource(Bindings bindings, Expression expression)
@@ -70,9 +68,7 @@ namespace Lucene.Net.Expressions
this.needsScores = needsScores;
}
-
- public override FunctionValues GetValues(IDictionary context, AtomicReaderContext
- readerContext)
+ public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
{
IDictionary<string, FunctionValues> valuesCache = (IDictionary<string, FunctionValues>)context["valuesCache"];
if (valuesCache == null)
@@ -134,8 +130,7 @@ namespace Lucene.Net.Expressions
{
return false;
}
- Lucene.Net.Expressions.ExpressionValueSource other = (Lucene.Net.Expressions.ExpressionValueSource
- )obj;
+ ExpressionValueSource other = (ExpressionValueSource)obj;
if (expression == null)
{
if (other.expression != null)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0d5490e8/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs b/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
index f3e42f0..f173ca9 100644
--- a/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
+++ b/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
@@ -82,7 +82,7 @@ namespace Lucene.Net.Expressions.JS
private static readonly Type FUNCTION_VALUES_TYPE = typeof(FunctionValues);
private static readonly ConstructorInfo EXPRESSION_CTOR = typeof(Expression).
- GetConstructor(new Type[] { typeof(String), typeof(String[]) });
+ GetConstructor(new Type[] { typeof(string), typeof(string[]) });
private static readonly MethodInfo EVALUATE_METHOD = GetMethod(EXPRESSION_TYPE, "Evaluate",
new[] { typeof(int), typeof(FunctionValues[]) });
@@ -162,7 +162,6 @@ namespace Lucene.Net.Expressions.JS
public static Expression Compile(string sourceText, IDictionary<string, MethodInfo> functions)
{
-
foreach (MethodInfo m in functions.Values)
{
CheckFunction(m);
@@ -187,15 +186,13 @@ namespace Lucene.Net.Expressions.JS
/// <param name="sourceText">The expression to compile</param>
private JavascriptCompiler(string sourceText)
- : this(sourceText, DEFAULT_FUNCTIONS
- )
+ : this(sourceText, DEFAULT_FUNCTIONS)
{
}
/// <summary>Constructs a compiler for expressions with specific set of functions</summary>
/// <param name="sourceText">The expression to compile</param>
- private JavascriptCompiler(string sourceText, IDictionary<string, MethodInfo> functions
- )
+ private JavascriptCompiler(string sourceText, IDictionary<string, MethodInfo> functions)
{
if (sourceText == null)
{
@@ -572,7 +569,6 @@ namespace Lucene.Net.Expressions.JS
RecursiveCompile(current.GetChild(1), arg2);
gen.Emit(op);
gen.Emit(OpCodes.Conv_R8);
-
}
private void PushBitwise(OpCode op, ITree current)
@@ -587,20 +583,16 @@ namespace Lucene.Net.Expressions.JS
RecursiveCompile(current.GetChild(1), arg2);
gen.Emit(op);
gen.Emit(OpCodes.Conv_R8);
-
}
private void PushCond(OpCode opCode, ITree current, Type expected)
{
-
RecursiveCompile(current.GetChild(0), expected);
RecursiveCompile(current.GetChild(1), expected);
gen.Emit(opCode);
gen.Emit(OpCodes.Conv_R8);
-
}
-
private void PushLong(long i)
{
gen.Emit(OpCodes.Ldc_I8,i);
@@ -608,7 +600,6 @@ namespace Lucene.Net.Expressions.JS
{
gen.Emit(OpCodes.Conv_R8);
}
-
}
private void EndCompile()
@@ -617,8 +608,6 @@ namespace Lucene.Net.Expressions.JS
dynamicType.DefineMethodOverride(evalMethod, EVALUATE_METHOD);
}
-
-
private ITree GetAntlrComputedExpressionTree()
{
ICharStream input = new ANTLRStringStream(sourceText);
@@ -635,8 +624,6 @@ namespace Lucene.Net.Expressions.JS
}
}
-
-
static JavascriptCompiler()
{
IDictionary<string, MethodInfo> map = new Dictionary<string, MethodInfo>();
@@ -728,7 +715,6 @@ namespace Lucene.Net.Expressions.JS
private static void CheckFunction(MethodInfo method)
{
-
// do some checks if the signature is "compatible":
if (!(method.IsStatic))
{
@@ -756,6 +742,4 @@ namespace Lucene.Net.Expressions.JS
}
}
}
-
-
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0d5490e8/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs b/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs
index 0646355..cab1627 100644
--- a/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs
+++ b/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs
@@ -2087,7 +2087,7 @@ loop2_break: ;
}
}
- protected internal JavascriptLexer.DFA9 dfa9;
+ protected JavascriptLexer.DFA9 dfa9;
internal static readonly string DFA9_eotS = "\x1\uffff\x2\x4\x3\uffff\x1\x4";
@@ -2132,7 +2132,7 @@ loop2_break: ;
}
}
- protected internal class DFA9 : DFA
+ protected class DFA9 : DFA
{
public DFA9(JavascriptLexer _enclosing, BaseRecognizer recognizer)
{
@@ -2161,11 +2161,14 @@ loop2_break: ;
}
}
- public class ParseException:Exception
+ // LUCENENET: All exeption classes should be marked serializable
+#if FEATURE_SERIALIZABLE
+ [Serializable]
+#endif
+ public class ParseException : Exception
{
public ParseException(string message, int charPositionInLine)
{
-
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0d5490e8/src/Lucene.Net.Expressions/JS/JavascriptParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/JS/JavascriptParser.cs b/src/Lucene.Net.Expressions/JS/JavascriptParser.cs
index 5b77351..518168f 100644
--- a/src/Lucene.Net.Expressions/JS/JavascriptParser.cs
+++ b/src/Lucene.Net.Expressions/JS/JavascriptParser.cs
@@ -116,7 +116,7 @@ namespace Lucene.Net.Expressions.JS
{
}
- protected internal ITreeAdaptor adaptor = new CommonTreeAdaptor();
+ protected ITreeAdaptor adaptor = new CommonTreeAdaptor();
public virtual ITreeAdaptor TreeAdaptor
{
@@ -349,7 +349,7 @@ namespace Lucene.Net.Expressions.JS
}
}
- internal class ExpressionReturn<TToken> : ParserRuleReturnScope<TToken>
+ public class ExpressionReturn<TToken> : ParserRuleReturnScope<TToken>
{
}
@@ -460,7 +460,7 @@ namespace Lucene.Net.Expressions.JS
// $ANTLR start "logical_or"
// src/java/org/apache/lucene/expressions/js/Javascript.g:258:1: logical_or : logical_and ( AT_BOOL_OR ^ logical_and )* ;
- public AstParserRuleReturnScope<ITree, IToken> Logical_or()
+ public AstParserRuleReturnScope<ITree, IToken> Logical_or() // LUCENENET TODO: Rename Logical_Or()
{
var retval = new AstParserRuleReturnScope<ITree, IToken> { Start = input.LT(1) };
CommonTree root_0;
@@ -530,7 +530,7 @@ namespace Lucene.Net.Expressions.JS
// $ANTLR start "logical_and"
// src/java/org/apache/lucene/expressions/js/Javascript.g:262:1: logical_and : bitwise_or ( AT_BOOL_AND ^ bitwise_or )* ;
- public AstParserRuleReturnScope<ITree, IToken> Logical_and()
+ public AstParserRuleReturnScope<ITree, IToken> Logical_and() // LUCENENET TODO: Rename Logical_And()
{
var retval = new AstParserRuleReturnScope<ITree, IToken> { Start = input.LT(1) };
CommonTree root;
@@ -599,7 +599,7 @@ namespace Lucene.Net.Expressions.JS
// $ANTLR start "bitwise_or"
// src/java/org/apache/lucene/expressions/js/Javascript.g:266:1: bitwise_or : bitwise_xor ( AT_BIT_OR ^ bitwise_xor )* ;
- public AstParserRuleReturnScope<ITree, IToken> Bitwise_or()
+ public AstParserRuleReturnScope<ITree, IToken> Bitwise_or() // LUCENENET TODO: Rename Bitwise_Or()
{
var retval = new AstParserRuleReturnScope<ITree, IToken> { Start = input.LT(1) };
try
@@ -663,7 +663,7 @@ namespace Lucene.Net.Expressions.JS
// $ANTLR start "bitwise_xor"
// src/java/org/apache/lucene/expressions/js/Javascript.g:270:1: bitwise_xor : bitwise_and ( AT_BIT_XOR ^ bitwise_and )* ;
- public AstParserRuleReturnScope<ITree, IToken> Bitwise_xor()
+ public AstParserRuleReturnScope<ITree, IToken> Bitwise_xor() // LUCENENET TODO: Rename Bitwise_XOr()
{
var retval = new AstParserRuleReturnScope<ITree, IToken> { Start = input.LT(1) };
try
@@ -730,7 +730,7 @@ namespace Lucene.Net.Expressions.JS
// $ANTLR start "bitwise_and"
// src/java/org/apache/lucene/expressions/js/Javascript.g:274:1: bitwise_and : equality ( AT_BIT_AND ^ equality )* ;
- public AstParserRuleReturnScope<ITree, IToken> Bitwise_and()
+ public AstParserRuleReturnScope<ITree, IToken> Bitwise_and() // LUCENENET TODO: Rename Bitwise_And()
{
var retval = new AstParserRuleReturnScope<ITree, IToken> { Start = input.LT(1) };
try
@@ -1285,7 +1285,7 @@ namespace Lucene.Net.Expressions.JS
// $ANTLR start "unary_operator"
// src/java/org/apache/lucene/expressions/js/Javascript.g:304:1: unary_operator : ( AT_SUBTRACT -> AT_NEGATE | AT_BIT_NOT | AT_BOOL_NOT );
- public AstParserRuleReturnScope<ITree, IToken> Unary_operator()
+ public AstParserRuleReturnScope<ITree, IToken> Unary_operator() // LUCENENET TODO: Rename Unary_Operator()
{
var retval = new AstParserRuleReturnScope<ITree, IToken> { Start = input.LT(1) };
CommonTree root = null;
@@ -1863,6 +1863,4 @@ namespace Lucene.Net.Expressions.JS
// $ANTLR end "numeric"
// Delegated rules
}
-
-
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0d5490e8/src/Lucene.Net.Expressions/Lucene.Net.Expressions.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/Lucene.Net.Expressions.csproj b/src/Lucene.Net.Expressions/Lucene.Net.Expressions.csproj
index bc0477b..d0d2161 100644
--- a/src/Lucene.Net.Expressions/Lucene.Net.Expressions.csproj
+++ b/src/Lucene.Net.Expressions/Lucene.Net.Expressions.csproj
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DefineConstants>TRACE;DEBUG;FEATURE_SERIALIZABLE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0d5490e8/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ScoreFunctionValues.cs b/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
index 5ce9189..50dc769 100644
--- a/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
+++ b/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
@@ -25,6 +25,7 @@ namespace Lucene.Net.Expressions
public override double DoubleVal(int document)
{
+ // LUCENENET TODO: Possible Bug: Put in try-catch and rethrow "RuntimeException"
Debug.Assert(document == scorer.DocID);
var score = scorer.GetScore();
Console.WriteLine("Score = {0}",score);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0d5490e8/src/Lucene.Net.Expressions/ScoreValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ScoreValueSource.cs b/src/Lucene.Net.Expressions/ScoreValueSource.cs
index e58aafa..5a14e94 100644
--- a/src/Lucene.Net.Expressions/ScoreValueSource.cs
+++ b/src/Lucene.Net.Expressions/ScoreValueSource.cs
@@ -19,8 +19,6 @@ namespace Lucene.Net.Expressions
/// </summary>
internal class ScoreValueSource : ValueSource
{
- private Scorer hashCodeObj;
-
/// <summary>
/// <code>context</code> must contain a key "scorer" which is a
/// <see cref="Lucene.Net.Search.Scorer">Lucene.Net.Search.Scorer</see>
@@ -31,11 +29,9 @@ namespace Lucene.Net.Expressions
readerContext)
{
Scorer v = (Scorer)context["scorer"];
- hashCodeObj = v;
if (v == null)
{
- throw new InvalidOperationException("Expressions referencing the score can only be used for sorting"
- );
+ throw new InvalidOperationException("Expressions referencing the score can only be used for sorting");
}
return new ScoreFunctionValues(this, v);
}
@@ -47,8 +43,7 @@ namespace Lucene.Net.Expressions
public override int GetHashCode()
{
- //TODO: revist this and return something meaningful
- return 777;
+ return 777; // LUCENENET TODO: return RuntimeHelpers.GetHashCode(this);
}
public override string GetDescription()
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0d5490e8/src/Lucene.Net.Expressions/SimpleBindings.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/SimpleBindings.cs b/src/Lucene.Net.Expressions/SimpleBindings.cs
index fabe242..99e9bac 100644
--- a/src/Lucene.Net.Expressions/SimpleBindings.cs
+++ b/src/Lucene.Net.Expressions/SimpleBindings.cs
@@ -31,8 +31,12 @@ namespace Lucene.Net.Expressions
/// <lucene.experimental></lucene.experimental>
public sealed class SimpleBindings : Bindings
{
- internal readonly IDictionary<string, object> map = new Dictionary<string, object
- >();
+ internal readonly IDictionary<string, object> map = new Dictionary<string, object>();
+
+ /// <summary>
+ /// Creates a new empty <see cref="Bindings"/>
+ /// </summary>
+ public SimpleBindings() { }
/// <summary>Adds a SortField to the bindings.</summary>
/// <remarks>
@@ -59,9 +63,8 @@ namespace Lucene.Net.Expressions
public override ValueSource GetValueSource(string name)
{
-
object o;
- //.NET Port. Directly looking up a missing key will throw a KeyNotFoundException
+ // LUCENENET NOTE: Directly looking up a missing key will throw a KeyNotFoundException
if (!map.TryGetValue(name, out o))
{
throw new ArgumentException("Invalid reference '" + name + "'");
@@ -104,7 +107,6 @@ namespace Lucene.Net.Expressions
throw new NotSupportedException();
}
}
-
}
/// <summary>Traverses the graph of bindings, checking there are no cycles or missing references
[03/11] lucenenet git commit: Lucene.Net.Expressions: usings and
license headers
Posted by ni...@apache.org.
Lucene.Net.Expressions: usings and license headers
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/fa4ab1b1
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/fa4ab1b1
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/fa4ab1b1
Branch: refs/heads/api-work
Commit: fa4ab1b13077f23bb3c245703511f16068bdfe11
Parents: 0d5490e
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Jan 26 14:45:52 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Jan 26 14:45:52 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Expressions/Bindings.cs | 35 +++++++++---
src/Lucene.Net.Expressions/Expression.cs | 59 +++++++++++++-------
.../ExpressionComparator.cs | 25 +++++++--
.../ExpressionFunctionValues.cs | 33 ++++++++---
.../ExpressionRescorer.cs | 21 ++++++-
.../ExpressionSortField.cs | 33 ++++++++---
.../ExpressionValueSource.cs | 45 ++++++++++-----
.../JS/JavascriptCompiler.cs | 44 +++++++--------
.../JS/JavascriptLexer.cs | 3 +-
.../JS/JavascriptParser.cs | 22 ++++----
.../ScoreFunctionValues.cs | 22 +++++++-
src/Lucene.Net.Expressions/ScoreValueSource.cs | 45 ++++++++++-----
src/Lucene.Net.Expressions/SimpleBindings.cs | 21 ++++++-
13 files changed, 289 insertions(+), 119 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fa4ab1b1/src/Lucene.Net.Expressions/Bindings.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/Bindings.cs b/src/Lucene.Net.Expressions/Bindings.cs
index 59f12de..4cfdcdc 100644
--- a/src/Lucene.Net.Expressions/Bindings.cs
+++ b/src/Lucene.Net.Expressions/Bindings.cs
@@ -2,15 +2,32 @@ using Lucene.Net.Queries.Function;
namespace Lucene.Net.Expressions
{
- /// <summary>Binds variable names in expressions to actual data.</summary>
- /// <remarks>
- /// Binds variable names in expressions to actual data.
- /// <p>
- /// These are typically DocValues fields/FieldCache, the document's
- /// relevance score, or other ValueSources.
- /// </remarks>
- /// <lucene.experimental></lucene.experimental>
- public abstract class Bindings
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /// <summary>Binds variable names in expressions to actual data.</summary>
+ /// <remarks>
+ /// Binds variable names in expressions to actual data.
+ /// <p>
+ /// These are typically DocValues fields/FieldCache, the document's
+ /// relevance score, or other ValueSources.
+ /// </remarks>
+ /// <lucene.experimental></lucene.experimental>
+ public abstract class Bindings
{
/// <summary>Sole constructor.</summary>
/// <remarks>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fa4ab1b1/src/Lucene.Net.Expressions/Expression.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/Expression.cs b/src/Lucene.Net.Expressions/Expression.cs
index 3c40f4c..5eadc60 100644
--- a/src/Lucene.Net.Expressions/Expression.cs
+++ b/src/Lucene.Net.Expressions/Expression.cs
@@ -3,27 +3,44 @@ using Lucene.Net.Search;
namespace Lucene.Net.Expressions
{
- /// <summary>Base class that computes the value of an expression for a document.</summary>
- /// <remarks>
- /// Base class that computes the value of an expression for a document.
- /// <p>
- /// Example usage:
- /// <pre class="prettyprint">
- /// // compile an expression:
- /// Expression expr = JavascriptCompiler.compile("sqrt(_score) + ln(popularity)");
- /// // SimpleBindings just maps variables to SortField instances
- /// SimpleBindings bindings = new SimpleBindings();
- /// bindings.add(new SortField("_score", SortField.Type.SCORE));
- /// bindings.add(new SortField("popularity", SortField.Type.INT));
- /// // create a sort field and sort by it (reverse order)
- /// Sort sort = new Sort(expr.getSortField(bindings, true));
- /// Query query = new TermQuery(new Term("body", "contents"));
- /// searcher.search(query, null, 10, sort);
- /// </pre>
- /// </remarks>
- /// <seealso cref="Lucene.Net.Expressions.JS.JavascriptCompiler.Compile(string)">Lucene.Net.Expressions.JS.JavascriptCompiler.Compile(string)</seealso>
- /// <lucene.experimental></lucene.experimental>
- public abstract class Expression
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /// <summary>Base class that computes the value of an expression for a document.</summary>
+ /// <remarks>
+ /// Base class that computes the value of an expression for a document.
+ /// <p>
+ /// Example usage:
+ /// <pre class="prettyprint">
+ /// // compile an expression:
+ /// Expression expr = JavascriptCompiler.compile("sqrt(_score) + ln(popularity)");
+ /// // SimpleBindings just maps variables to SortField instances
+ /// SimpleBindings bindings = new SimpleBindings();
+ /// bindings.add(new SortField("_score", SortField.Type.SCORE));
+ /// bindings.add(new SortField("popularity", SortField.Type.INT));
+ /// // create a sort field and sort by it (reverse order)
+ /// Sort sort = new Sort(expr.getSortField(bindings, true));
+ /// Query query = new TermQuery(new Term("body", "contents"));
+ /// searcher.search(query, null, 10, sort);
+ /// </pre>
+ /// </remarks>
+ /// <seealso cref="Lucene.Net.Expressions.JS.JavascriptCompiler.Compile(string)">Lucene.Net.Expressions.JS.JavascriptCompiler.Compile(string)</seealso>
+ /// <lucene.experimental></lucene.experimental>
+ public abstract class Expression
{
/// <summary>The original source text</summary>
public readonly string sourceText; // LUCENENET TODO: Make property
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fa4ab1b1/src/Lucene.Net.Expressions/ExpressionComparator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ExpressionComparator.cs b/src/Lucene.Net.Expressions/ExpressionComparator.cs
index 2b22f76..56f98ab 100644
--- a/src/Lucene.Net.Expressions/ExpressionComparator.cs
+++ b/src/Lucene.Net.Expressions/ExpressionComparator.cs
@@ -1,14 +1,29 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
using Lucene.Net.Index;
using Lucene.Net.Queries.Function;
using Lucene.Net.Search;
-using Lucene.Net.Support;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
namespace Lucene.Net.Expressions
{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
/// <summary>A custom comparer for sorting documents by an expression</summary>
internal class ExpressionComparer : FieldComparer<double>
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fa4ab1b1/src/Lucene.Net.Expressions/ExpressionFunctionValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ExpressionFunctionValues.cs b/src/Lucene.Net.Expressions/ExpressionFunctionValues.cs
index 93adf84..b6de614 100644
--- a/src/Lucene.Net.Expressions/ExpressionFunctionValues.cs
+++ b/src/Lucene.Net.Expressions/ExpressionFunctionValues.cs
@@ -1,16 +1,33 @@
-using System;
using Lucene.Net.Queries.Function;
using Lucene.Net.Queries.Function.DocValues;
+using System;
namespace Lucene.Net.Expressions
{
- /// <summary>
- /// A
- /// <see cref="Lucene.Net.Queries.Function.FunctionValues">Lucene.Net.Queries.Function.FunctionValues
- /// </see>
- /// which evaluates an expression
- /// </summary>
- internal class ExpressionFunctionValues : DoubleDocValues
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /// <summary>
+ /// A
+ /// <see cref="Lucene.Net.Queries.Function.FunctionValues">Lucene.Net.Queries.Function.FunctionValues
+ /// </see>
+ /// which evaluates an expression
+ /// </summary>
+ internal class ExpressionFunctionValues : DoubleDocValues
{
internal readonly Expression expression;
internal readonly FunctionValues[] functionValues;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fa4ab1b1/src/Lucene.Net.Expressions/ExpressionRescorer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ExpressionRescorer.cs b/src/Lucene.Net.Expressions/ExpressionRescorer.cs
index aa8b249..78ef4f5 100644
--- a/src/Lucene.Net.Expressions/ExpressionRescorer.cs
+++ b/src/Lucene.Net.Expressions/ExpressionRescorer.cs
@@ -1,10 +1,27 @@
-using System;
-using System.Collections.Generic;
using Lucene.Net.Index;
using Lucene.Net.Search;
+using System;
+using System.Collections.Generic;
namespace Lucene.Net.Expressions
{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
/// <summary>
/// A
/// <see cref="Lucene.Net.Search.Rescorer">Lucene.Net.Search.Rescorer</see>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fa4ab1b1/src/Lucene.Net.Expressions/ExpressionSortField.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ExpressionSortField.cs b/src/Lucene.Net.Expressions/ExpressionSortField.cs
index 0f1da11..d09bcfd 100644
--- a/src/Lucene.Net.Expressions/ExpressionSortField.cs
+++ b/src/Lucene.Net.Expressions/ExpressionSortField.cs
@@ -1,15 +1,32 @@
-using System.Text;
using Lucene.Net.Search;
+using System.Text;
namespace Lucene.Net.Expressions
{
- /// <summary>
- /// A
- /// <see cref="Lucene.Net.Search.SortField">Lucene.Net.Search.SortField
- /// </see>
- /// which sorts documents by the evaluated value of an expression for each document
- /// </summary>
- internal class ExpressionSortField : SortField
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /// <summary>
+ /// A
+ /// <see cref="Lucene.Net.Search.SortField">Lucene.Net.Search.SortField
+ /// </see>
+ /// which sorts documents by the evaluated value of an expression for each document
+ /// </summary>
+ internal class ExpressionSortField : SortField
{
private readonly ExpressionValueSource source;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fa4ab1b1/src/Lucene.Net.Expressions/ExpressionValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ExpressionValueSource.cs b/src/Lucene.Net.Expressions/ExpressionValueSource.cs
index 87d7d7c..254ec77 100644
--- a/src/Lucene.Net.Expressions/ExpressionValueSource.cs
+++ b/src/Lucene.Net.Expressions/ExpressionValueSource.cs
@@ -1,24 +1,41 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
using Lucene.Net.Index;
using Lucene.Net.Queries.Function;
using Lucene.Net.Search;
using Lucene.Net.Support;
+using System;
+using System.Collections;
+using System.Collections.Generic;
namespace Lucene.Net.Expressions
{
- /// <summary>
- /// A
- /// <see cref="Lucene.Net.Queries.Function.ValueSource">Lucene.Net.Queries.Function.ValueSource
- /// </see>
- /// which evaluates a
- /// <see cref="Expression">Expression</see>
- /// given the context of an
- /// <see cref="Bindings">Bindings</see>
- /// .
- /// </summary>
- internal sealed class ExpressionValueSource : ValueSource
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /// <summary>
+ /// A
+ /// <see cref="Lucene.Net.Queries.Function.ValueSource">Lucene.Net.Queries.Function.ValueSource
+ /// </see>
+ /// which evaluates a
+ /// <see cref="Expression">Expression</see>
+ /// given the context of an
+ /// <see cref="Bindings">Bindings</see>
+ /// .
+ /// </summary>
+ internal sealed class ExpressionValueSource : ValueSource
{
internal readonly ValueSource[] variables;
internal readonly Expression expression;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fa4ab1b1/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs b/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
index f173ca9..7706baa 100644
--- a/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
+++ b/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
@@ -1,40 +1,40 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
+using Antlr.Runtime;
+using Antlr.Runtime.Tree;
+using Lucene.Net.Queries.Function;
+using Lucene.Net.Support;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
-using Antlr.Runtime;
-using Antlr.Runtime.Tree;
-using Lucene.Net.Queries.Function;
-using Lucene.Net.Support;
#if NETSTANDARD
-using System.IO;
using Lucene.Net.Support.Configuration;
using Microsoft.Extensions.Configuration;
+using System.IO;
#else
using System.Configuration;
#endif
namespace Lucene.Net.Expressions.JS
{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
/// <summary>An expression compiler for javascript expressions.</summary>
/// <remarks>
/// An expression compiler for javascript expressions.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fa4ab1b1/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs b/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs
index cab1627..606100d 100644
--- a/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs
+++ b/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs
@@ -1,3 +1,5 @@
+// ANTLR GENERATED CODE: DO NOT EDIT (LUCENENET: Not really auto generated in the port)
+
using System;
using Antlr.Runtime;
@@ -87,7 +89,6 @@ namespace Lucene.Net.Expressions.JS
public const int WS = 43;
- // ANTLR GENERATED CODE: DO NOT EDIT
public override void DisplayRecognitionError(string[] tokenNames, RecognitionException re)
{
string message = " unexpected character '" + (char)re.Character + "' at position (" + re.CharPositionInLine + ").";
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fa4ab1b1/src/Lucene.Net.Expressions/JS/JavascriptParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/JS/JavascriptParser.cs b/src/Lucene.Net.Expressions/JS/JavascriptParser.cs
index 518168f..eedd1de 100644
--- a/src/Lucene.Net.Expressions/JS/JavascriptParser.cs
+++ b/src/Lucene.Net.Expressions/JS/JavascriptParser.cs
@@ -1,21 +1,24 @@
+// ANTLR GENERATED CODE: DO NOT EDIT (LUCENENET: Not really auto generated in the port)
+
using System;
using Antlr.Runtime;
using Antlr.Runtime.Tree;
-
namespace Lucene.Net.Expressions.JS
{
internal class JavascriptParser : Parser
{
public static readonly string[] tokenNames =
- { "<invalid>", "<EOR>",
- "<DOWN>", "<UP>", "AT_ADD", "AT_BIT_AND", "AT_BIT_NOT", "AT_BIT_OR", "AT_BIT_SHL"
- , "AT_BIT_SHR", "AT_BIT_SHU", "AT_BIT_XOR", "AT_BOOL_AND", "AT_BOOL_NOT", "AT_BOOL_OR"
- , "AT_CALL", "AT_COLON", "AT_COMMA", "AT_COMP_EQ", "AT_COMP_GT", "AT_COMP_GTE",
- "AT_COMP_LT", "AT_COMP_LTE", "AT_COMP_NEQ", "AT_COND_QUE", "AT_DIVIDE", "AT_DOT"
- , "AT_LPAREN", "AT_MODULO", "AT_MULTIPLY", "AT_NEGATE", "AT_RPAREN", "AT_SUBTRACT"
- , "DECIMAL", "DECIMALDIGIT", "DECIMALINTEGER", "EXPONENT", "HEX", "HEXDIGIT", "ID"
- , "NAMESPACE_ID", "OCTAL", "OCTALDIGIT", "WS" };
+ {
+ "<invalid>", "<EOR>", "<DOWN>", "<UP>", "AT_ADD", "AT_BIT_AND", "AT_BIT_NOT",
+ "AT_BIT_OR", "AT_BIT_SHL", "AT_BIT_SHR", "AT_BIT_SHU", "AT_BIT_XOR", "AT_BOOL_AND",
+ "AT_BOOL_NOT", "AT_BOOL_OR", "AT_CALL", "AT_COLON", "AT_COMMA", "AT_COMP_EQ",
+ "AT_COMP_GT", "AT_COMP_GTE", "AT_COMP_LT", "AT_COMP_LTE", "AT_COMP_NEQ",
+ "AT_COND_QUE", "AT_DIVIDE", "AT_DOT", "AT_LPAREN", "AT_MODULO", "AT_MULTIPLY",
+ "AT_NEGATE", "AT_RPAREN", "AT_SUBTRACT", "DECIMAL", "DECIMALDIGIT", "DECIMALINTEGER",
+ "EXPONENT", "HEX", "HEXDIGIT", "ID", "NAMESPACE_ID", "OCTAL", "OCTALDIGIT",
+ "WS"
+ };
public const int EOF = -1;
@@ -99,7 +102,6 @@ namespace Lucene.Net.Expressions.JS
public const int WS = 43;
- // ANTLR GENERATED CODE: DO NOT EDIT
// delegates
public virtual Parser[] GetDelegates()
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fa4ab1b1/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ScoreFunctionValues.cs b/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
index 50dc769..331bebb 100644
--- a/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
+++ b/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
@@ -1,12 +1,28 @@
-using System;
-using System.Diagnostics;
-using System.IO;
using Lucene.Net.Queries.Function;
using Lucene.Net.Queries.Function.DocValues;
using Lucene.Net.Search;
+using System;
+using System.Diagnostics;
namespace Lucene.Net.Expressions
{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
/// <summary>
/// A utility class to allow expressions to access the score as a
/// <see cref="Lucene.Net.Queries.Function.FunctionValues">Lucene.Net.Queries.Function.FunctionValues
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fa4ab1b1/src/Lucene.Net.Expressions/ScoreValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ScoreValueSource.cs b/src/Lucene.Net.Expressions/ScoreValueSource.cs
index 5a14e94..2b06093 100644
--- a/src/Lucene.Net.Expressions/ScoreValueSource.cs
+++ b/src/Lucene.Net.Expressions/ScoreValueSource.cs
@@ -1,23 +1,40 @@
-using System;
-using System.Collections;
using Lucene.Net.Index;
using Lucene.Net.Queries.Function;
using Lucene.Net.Search;
+using System;
+using System.Collections;
namespace Lucene.Net.Expressions
{
- /// <summary>
- /// A
- /// <see cref="Lucene.Net.Queries.Function.ValueSource">Lucene.Net.Queries.Function.ValueSource
- /// </see>
- /// which uses the
- /// <see cref="Lucene.Net.Search.Scorer">Lucene.Net.Search.Scorer</see>
- /// passed through
- /// the context map by
- /// <see cref="ExpressionComparer">ExpressionComparer</see>
- /// .
- /// </summary>
- internal class ScoreValueSource : ValueSource
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /// <summary>
+ /// A
+ /// <see cref="Lucene.Net.Queries.Function.ValueSource">Lucene.Net.Queries.Function.ValueSource
+ /// </see>
+ /// which uses the
+ /// <see cref="Lucene.Net.Search.Scorer">Lucene.Net.Search.Scorer</see>
+ /// passed through
+ /// the context map by
+ /// <see cref="ExpressionComparer">ExpressionComparer</see>
+ /// .
+ /// </summary>
+ internal class ScoreValueSource : ValueSource
{
/// <summary>
/// <code>context</code> must contain a key "scorer" which is a
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fa4ab1b1/src/Lucene.Net.Expressions/SimpleBindings.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/SimpleBindings.cs b/src/Lucene.Net.Expressions/SimpleBindings.cs
index 99e9bac..af06d6f 100644
--- a/src/Lucene.Net.Expressions/SimpleBindings.cs
+++ b/src/Lucene.Net.Expressions/SimpleBindings.cs
@@ -1,11 +1,28 @@
-using System;
-using System.Collections.Generic;
using Lucene.Net.Queries.Function;
using Lucene.Net.Queries.Function.ValueSources;
using Lucene.Net.Search;
+using System;
+using System.Collections.Generic;
namespace Lucene.Net.Expressions
{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
/// <summary>
/// Simple class that binds expression variable names to
/// <see cref="Lucene.Net.Search.SortField">Lucene.Net.Search.SortField
[06/11] lucenenet git commit:
Lucene.Net.Expressions.JS.JavascriptParser refactor: Logical_or() >
Logical_Or(), Logical_and() > Logical_And(), Bitwise_or() > Bitwise_Or(),
Bitwise_xor() > Bitwise_XOr(), Bitwise_and() > Bitwise_And(),
Unary_operator() > U
Posted by ni...@apache.org.
Lucene.Net.Expressions.JS.JavascriptParser refactor: Logical_or() > Logical_Or(), Logical_and() > Logical_And(), Bitwise_or() > Bitwise_Or(), Bitwise_xor() > Bitwise_XOr(), Bitwise_and() > Bitwise_And(), Unary_operator() > Unary_Operator()
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/f88120c5
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/f88120c5
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/f88120c5
Branch: refs/heads/api-work
Commit: f88120c5a4d5dc554e43724cbbcf324baebb6f95
Parents: c79c9eb
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Jan 26 15:49:32 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Jan 26 15:49:32 2017 +0700
----------------------------------------------------------------------
.../JS/JavascriptParser.cs | 32 ++++++++++----------
1 file changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f88120c5/src/Lucene.Net.Expressions/JS/JavascriptParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/JS/JavascriptParser.cs b/src/Lucene.Net.Expressions/JS/JavascriptParser.cs
index eedd1de..d495943 100644
--- a/src/Lucene.Net.Expressions/JS/JavascriptParser.cs
+++ b/src/Lucene.Net.Expressions/JS/JavascriptParser.cs
@@ -414,7 +414,7 @@ namespace Lucene.Net.Expressions.JS
// src/java/org/apache/lucene/expressions/js/Javascript.g:255:7: logical_or ( AT_COND_QUE ^ conditional AT_COLON ! conditional )?
root_0 = (CommonTree)adaptor.Nil();
PushFollow(FOLLOW_logical_or_in_conditional757);
- logical_or3 = Logical_or();
+ logical_or3 = Logical_Or();
state._fsp--;
adaptor.AddChild(root_0, logical_or3.Tree);
// src/java/org/apache/lucene/expressions/js/Javascript.g:255:18: ( AT_COND_QUE ^ conditional AT_COLON ! conditional )?
@@ -462,7 +462,7 @@ namespace Lucene.Net.Expressions.JS
// $ANTLR start "logical_or"
// src/java/org/apache/lucene/expressions/js/Javascript.g:258:1: logical_or : logical_and ( AT_BOOL_OR ^ logical_and )* ;
- public AstParserRuleReturnScope<ITree, IToken> Logical_or() // LUCENENET TODO: Rename Logical_Or()
+ public AstParserRuleReturnScope<ITree, IToken> Logical_Or()
{
var retval = new AstParserRuleReturnScope<ITree, IToken> { Start = input.LT(1) };
CommonTree root_0;
@@ -477,7 +477,7 @@ namespace Lucene.Net.Expressions.JS
// src/java/org/apache/lucene/expressions/js/Javascript.g:259:7: logical_and ( AT_BOOL_OR ^ logical_and )*
root_0 = (CommonTree)adaptor.Nil();
PushFollow(FOLLOW_logical_and_in_logical_or787);
- logical_and8 = Logical_and();
+ logical_and8 = Logical_And();
state._fsp--;
adaptor.AddChild(root_0, logical_and8.Tree);
// src/java/org/apache/lucene/expressions/js/Javascript.g:259:19: ( AT_BOOL_OR ^ logical_and )*
@@ -498,7 +498,7 @@ namespace Lucene.Net.Expressions.JS
AT_BOOL_OR9_tree = (CommonTree)adaptor.Create(AT_BOOL_OR9);
root_0 = (CommonTree)adaptor.BecomeRoot(AT_BOOL_OR9_tree, root_0);
PushFollow(FOLLOW_logical_and_in_logical_or793);
- logical_and10 = Logical_and();
+ logical_and10 = Logical_And();
state._fsp--;
adaptor.AddChild(root_0, logical_and10.Tree);
break;
@@ -532,7 +532,7 @@ namespace Lucene.Net.Expressions.JS
// $ANTLR start "logical_and"
// src/java/org/apache/lucene/expressions/js/Javascript.g:262:1: logical_and : bitwise_or ( AT_BOOL_AND ^ bitwise_or )* ;
- public AstParserRuleReturnScope<ITree, IToken> Logical_and() // LUCENENET TODO: Rename Logical_And()
+ public AstParserRuleReturnScope<ITree, IToken> Logical_And()
{
var retval = new AstParserRuleReturnScope<ITree, IToken> { Start = input.LT(1) };
CommonTree root;
@@ -547,7 +547,7 @@ namespace Lucene.Net.Expressions.JS
// src/java/org/apache/lucene/expressions/js/Javascript.g:263:7: bitwise_or ( AT_BOOL_AND ^ bitwise_or )*
root = (CommonTree)adaptor.Nil();
PushFollow(FOLLOW_bitwise_or_in_logical_and812);
- bitwise_or11 = Bitwise_or();
+ bitwise_or11 = Bitwise_Or();
state._fsp--;
adaptor.AddChild(root, bitwise_or11.Tree);
// src/java/org/apache/lucene/expressions/js/Javascript.g:263:18: ( AT_BOOL_AND ^ bitwise_or )*
@@ -568,7 +568,7 @@ namespace Lucene.Net.Expressions.JS
AT_BOOL_AND12_tree = (CommonTree)adaptor.Create(AT_BOOL_AND12);
root = (CommonTree)adaptor.BecomeRoot(AT_BOOL_AND12_tree, root);
PushFollow(FOLLOW_bitwise_or_in_logical_and818);
- bitwise_or13 = Bitwise_or();
+ bitwise_or13 = Bitwise_Or();
state._fsp--;
adaptor.AddChild(root, bitwise_or13.Tree);
break;
@@ -601,7 +601,7 @@ namespace Lucene.Net.Expressions.JS
// $ANTLR start "bitwise_or"
// src/java/org/apache/lucene/expressions/js/Javascript.g:266:1: bitwise_or : bitwise_xor ( AT_BIT_OR ^ bitwise_xor )* ;
- public AstParserRuleReturnScope<ITree, IToken> Bitwise_or() // LUCENENET TODO: Rename Bitwise_Or()
+ public AstParserRuleReturnScope<ITree, IToken> Bitwise_Or()
{
var retval = new AstParserRuleReturnScope<ITree, IToken> { Start = input.LT(1) };
try
@@ -612,7 +612,7 @@ namespace Lucene.Net.Expressions.JS
// src/java/org/apache/lucene/expressions/js/Javascript.g:267:7: bitwise_xor ( AT_BIT_OR ^ bitwise_xor )*
root = (CommonTree)adaptor.Nil();
PushFollow(FOLLOW_bitwise_xor_in_bitwise_or837);
- AstParserRuleReturnScope<ITree, IToken> bitwise_xor14 = Bitwise_xor();
+ AstParserRuleReturnScope<ITree, IToken> bitwise_xor14 = Bitwise_XOr();
state._fsp--;
adaptor.AddChild(root, bitwise_xor14.Tree);
// src/java/org/apache/lucene/expressions/js/Javascript.g:267:19: ( AT_BIT_OR ^ bitwise_xor )*
@@ -633,7 +633,7 @@ namespace Lucene.Net.Expressions.JS
CommonTree AT_BIT_OR15_tree = (CommonTree)adaptor.Create(AT_BIT_OR15);
root = (CommonTree)adaptor.BecomeRoot(AT_BIT_OR15_tree, root);
PushFollow(FOLLOW_bitwise_xor_in_bitwise_or843);
- AstParserRuleReturnScope<ITree, IToken> bitwise_xor16 = Bitwise_xor();
+ AstParserRuleReturnScope<ITree, IToken> bitwise_xor16 = Bitwise_XOr();
state._fsp--;
adaptor.AddChild(root, bitwise_xor16.Tree);
break;
@@ -665,7 +665,7 @@ namespace Lucene.Net.Expressions.JS
// $ANTLR start "bitwise_xor"
// src/java/org/apache/lucene/expressions/js/Javascript.g:270:1: bitwise_xor : bitwise_and ( AT_BIT_XOR ^ bitwise_and )* ;
- public AstParserRuleReturnScope<ITree, IToken> Bitwise_xor() // LUCENENET TODO: Rename Bitwise_XOr()
+ public AstParserRuleReturnScope<ITree, IToken> Bitwise_XOr()
{
var retval = new AstParserRuleReturnScope<ITree, IToken> { Start = input.LT(1) };
try
@@ -676,7 +676,7 @@ namespace Lucene.Net.Expressions.JS
// src/java/org/apache/lucene/expressions/js/Javascript.g:271:7: bitwise_and ( AT_BIT_XOR ^ bitwise_and )*
root = (CommonTree)adaptor.Nil();
PushFollow(FOLLOW_bitwise_and_in_bitwise_xor862);
- AstParserRuleReturnScope<ITree, IToken> bitwise_and17 = Bitwise_and();
+ AstParserRuleReturnScope<ITree, IToken> bitwise_and17 = Bitwise_And();
state._fsp--;
adaptor.AddChild(root, bitwise_and17.Tree);
// src/java/org/apache/lucene/expressions/js/Javascript.g:271:19: ( AT_BIT_XOR ^ bitwise_and )*
@@ -698,7 +698,7 @@ namespace Lucene.Net.Expressions.JS
CommonTree AT_BIT_XOR18_tree = (CommonTree)adaptor.Create(AT_BIT_XOR18);
root = (CommonTree)adaptor.BecomeRoot(AT_BIT_XOR18_tree, root);
PushFollow(FOLLOW_bitwise_and_in_bitwise_xor868);
- AstParserRuleReturnScope<ITree, IToken> bitwise_and19 = Bitwise_and();
+ AstParserRuleReturnScope<ITree, IToken> bitwise_and19 = Bitwise_And();
state._fsp--;
adaptor.AddChild(root, bitwise_and19.Tree);
break;
@@ -732,7 +732,7 @@ namespace Lucene.Net.Expressions.JS
// $ANTLR start "bitwise_and"
// src/java/org/apache/lucene/expressions/js/Javascript.g:274:1: bitwise_and : equality ( AT_BIT_AND ^ equality )* ;
- public AstParserRuleReturnScope<ITree, IToken> Bitwise_and() // LUCENENET TODO: Rename Bitwise_And()
+ public AstParserRuleReturnScope<ITree, IToken> Bitwise_And()
{
var retval = new AstParserRuleReturnScope<ITree, IToken> { Start = input.LT(1) };
try
@@ -1258,7 +1258,7 @@ namespace Lucene.Net.Expressions.JS
// src/java/org/apache/lucene/expressions/js/Javascript.g:301:7: unary_operator ^ unary
root = (CommonTree)adaptor.Nil();
PushFollow(FOLLOW_unary_operator_in_unary1103);
- AstParserRuleReturnScope<ITree, IToken> unary_operator41 = Unary_operator();
+ AstParserRuleReturnScope<ITree, IToken> unary_operator41 = Unary_Operator();
state._fsp--;
root = (CommonTree)adaptor.BecomeRoot(unary_operator41.Tree, root);
PushFollow(FOLLOW_unary_in_unary1106);
@@ -1287,7 +1287,7 @@ namespace Lucene.Net.Expressions.JS
// $ANTLR start "unary_operator"
// src/java/org/apache/lucene/expressions/js/Javascript.g:304:1: unary_operator : ( AT_SUBTRACT -> AT_NEGATE | AT_BIT_NOT | AT_BOOL_NOT );
- public AstParserRuleReturnScope<ITree, IToken> Unary_operator() // LUCENENET TODO: Rename Unary_Operator()
+ public AstParserRuleReturnScope<ITree, IToken> Unary_Operator()
{
var retval = new AstParserRuleReturnScope<ITree, IToken> { Start = input.LT(1) };
CommonTree root = null;
[10/11] lucenenet git commit:
Lucene.Net.Expressions.ScoreValueSource.GetHashCode(): Corrected
implementation to use RuntimeHelpers.GetHashCode(this),
the .NET equivalent of Java's System.identityHashCode(this).
Posted by ni...@apache.org.
Lucene.Net.Expressions.ScoreValueSource.GetHashCode(): Corrected implementation to use RuntimeHelpers.GetHashCode(this), the .NET equivalent of Java's System.identityHashCode(this).
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/90d64737
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/90d64737
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/90d64737
Branch: refs/heads/api-work
Commit: 90d6473726f2abc316c9334dbe9d2e91872a6699
Parents: 57d0d27
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Jan 26 16:59:41 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Jan 26 16:59:41 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Expressions/ScoreValueSource.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/90d64737/src/Lucene.Net.Expressions/ScoreValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ScoreValueSource.cs b/src/Lucene.Net.Expressions/ScoreValueSource.cs
index f825663..ad406cd 100644
--- a/src/Lucene.Net.Expressions/ScoreValueSource.cs
+++ b/src/Lucene.Net.Expressions/ScoreValueSource.cs
@@ -3,6 +3,7 @@ using Lucene.Net.Queries.Function;
using Lucene.Net.Search;
using System;
using System.Collections;
+using System.Runtime.CompilerServices;
namespace Lucene.Net.Expressions
{
@@ -53,7 +54,7 @@ namespace Lucene.Net.Expressions
public override int GetHashCode()
{
- return 777; // LUCENENET TODO: return RuntimeHelpers.GetHashCode(this);
+ return RuntimeHelpers.GetHashCode(this); // LUCENENET NOTE: This is equivalent to System.identityHashCode(this) in Java
}
public override string GetDescription()
[11/11] lucenenet git commit:
Lucene.Net.Expressions.ScoreFunctionValues: Added try catch block from
original implementation because it could potentially fix issues
Posted by ni...@apache.org.
Lucene.Net.Expressions.ScoreFunctionValues: Added try catch block from original implementation because it could potentially fix issues
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/8174a11c
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/8174a11c
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/8174a11c
Branch: refs/heads/api-work
Commit: 8174a11cc3141156a6fef64910541c9fe23a95d9
Parents: 90d6473
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Jan 26 17:05:34 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Jan 26 17:05:34 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Expressions/ScoreFunctionValues.cs | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8174a11c/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ScoreFunctionValues.cs b/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
index 0dfd838..d87c16f 100644
--- a/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
+++ b/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
@@ -3,6 +3,7 @@ using Lucene.Net.Queries.Function.DocValues;
using Lucene.Net.Search;
using System;
using System.Diagnostics;
+using System.IO;
namespace Lucene.Net.Expressions
{
@@ -39,11 +40,15 @@ namespace Lucene.Net.Expressions
public override double DoubleVal(int document)
{
- // LUCENENET TODO: Possible Bug: Put in try-catch and rethrow "RuntimeException"
- Debug.Assert(document == scorer.DocID);
- var score = scorer.GetScore();
- Console.WriteLine("Score = {0}",score);
- return score;
+ try
+ {
+ Debug.Assert(document == scorer.DocID);
+ return scorer.GetScore();
+ }
+ catch (IOException exception)
+ {
+ throw new Exception(exception.Message, exception);
+ }
}
}
}
[09/11] lucenenet git commit:
Lucene.Net.Core.Store.RateLimitedDirectoryWrapper: Commented check for null
UsageContext, since the value is non-nullable
Posted by ni...@apache.org.
Lucene.Net.Core.Store.RateLimitedDirectoryWrapper: Commented check for null UsageContext, since the value is non-nullable
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/57d0d278
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/57d0d278
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/57d0d278
Branch: refs/heads/api-work
Commit: 57d0d2782bc94449fadcd281268fe2af946437be
Parents: dbe66cc
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Jan 26 16:52:25 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Jan 26 16:52:25 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/57d0d278/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs b/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs
index d3fa8c0..6d651c2 100644
--- a/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs
+++ b/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs
@@ -89,13 +89,13 @@ namespace Lucene.Net.Store
/// if context is <code>null</code> </exception>
/// <exception cref="AlreadyClosedException"> if the <seealso cref="Directory"/> is already closed
/// @lucene.experimental </exception>
- public void SetMaxWriteMBPerSec(double? mbPerSec, IOContext.UsageContext context) // LUCENENET TODO: Can we get rid of the nullables?
+ public void SetMaxWriteMBPerSec(double? mbPerSec, IOContext.UsageContext context)
{
EnsureOpen();
- if (context == null)
- {
- throw new System.ArgumentException("Context must not be null");
- }
+ //if (context == null) // LUCENENET NOTE: enum values can never be null in .NET
+ //{
+ // throw new System.ArgumentException("Context must not be null");
+ //}
//int ord = context.ordinal();
RateLimiter limiter;
_contextRateLimiters.TryGetValue(context, out limiter);
[07/11] lucenenet git commit: Lucene.Net.Expressions BUG: Reverted to
public constructors on Bindings and Expression because they rely on something
(probably Reflection) to instantiate them
Posted by ni...@apache.org.
Lucene.Net.Expressions BUG: Reverted to public constructors on Bindings and Expression because they rely on something (probably Reflection) to instantiate them
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/8d6b6c96
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/8d6b6c96
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/8d6b6c96
Branch: refs/heads/api-work
Commit: 8d6b6c96e0d07ab1131b01968243a20c78897159
Parents: f88120c
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Jan 26 16:27:19 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Jan 26 16:45:49 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Expressions/Bindings.cs | 4 ++--
src/Lucene.Net.Expressions/Expression.cs | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8d6b6c96/src/Lucene.Net.Expressions/Bindings.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/Bindings.cs b/src/Lucene.Net.Expressions/Bindings.cs
index ee7f22d..8555a5e 100644
--- a/src/Lucene.Net.Expressions/Bindings.cs
+++ b/src/Lucene.Net.Expressions/Bindings.cs
@@ -34,8 +34,8 @@ namespace Lucene.Net.Expressions
/// Sole constructor. (For invocation by subclass
/// constructors, typically implicit.)
/// </remarks>
- protected Bindings()
- {
+ public Bindings() // LUCENENET NOTE: This must be public for the Reflection code to work right.
+ {
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8d6b6c96/src/Lucene.Net.Expressions/Expression.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/Expression.cs b/src/Lucene.Net.Expressions/Expression.cs
index 7189e6d..502aadc 100644
--- a/src/Lucene.Net.Expressions/Expression.cs
+++ b/src/Lucene.Net.Expressions/Expression.cs
@@ -60,7 +60,7 @@ namespace Lucene.Net.Expressions
/// <param name="variables">
/// Names of external variables referred to by the expression
/// </param>
- protected Expression(string sourceText, string[] variables)
+ public Expression(string sourceText, string[] variables) // LUCENENET NOTE: This must be public for the Reflection code to work right.
{
// javadocs
this.SourceText = sourceText;
[04/11] lucenenet git commit: Lucene.Net.Expressions: documentation
comments
Posted by ni...@apache.org.
Lucene.Net.Expressions: documentation comments
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/8ade0b43
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/8ade0b43
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/8ade0b43
Branch: refs/heads/api-work
Commit: 8ade0b432f7775f7a790d1fce2398ae4b905383d
Parents: fa4ab1b
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Jan 26 15:40:45 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Jan 26 15:40:45 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Expressions/Bindings.cs | 21 +++--
src/Lucene.Net.Expressions/Expression.cs | 52 +++++-------
.../ExpressionFunctionValues.cs | 5 +-
.../ExpressionRescorer.cs | 22 ++---
.../ExpressionSortField.cs | 5 +-
.../ExpressionValueSource.cs | 10 +--
.../JS/JavascriptCompiler.cs | 84 +++++++-------------
.../ScoreFunctionValues.cs | 4 +-
src/Lucene.Net.Expressions/ScoreValueSource.cs | 17 ++--
src/Lucene.Net.Expressions/SimpleBindings.cs | 39 ++++-----
10 files changed, 91 insertions(+), 168 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8ade0b43/src/Lucene.Net.Expressions/Bindings.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/Bindings.cs b/src/Lucene.Net.Expressions/Bindings.cs
index 4cfdcdc..ee7f22d 100644
--- a/src/Lucene.Net.Expressions/Bindings.cs
+++ b/src/Lucene.Net.Expressions/Bindings.cs
@@ -22,11 +22,11 @@ namespace Lucene.Net.Expressions
/// <summary>Binds variable names in expressions to actual data.</summary>
/// <remarks>
/// Binds variable names in expressions to actual data.
- /// <p>
+ /// <para/>
/// These are typically DocValues fields/FieldCache, the document's
- /// relevance score, or other ValueSources.
+ /// relevance score, or other <see cref="ValueSource"/>s.
+ /// @lucene.experimental
/// </remarks>
- /// <lucene.experimental></lucene.experimental>
public abstract class Bindings
{
/// <summary>Sole constructor.</summary>
@@ -38,16 +38,15 @@ namespace Lucene.Net.Expressions
{
}
- /// <summary>Returns a ValueSource bound to the variable name.</summary>
-
+ /// <summary>
+ /// Returns a <see cref="ValueSource"/> bound to the variable name.
+ /// </summary>
public abstract ValueSource GetValueSource(string name);
- /// <summary>
- /// Returns a
- /// <code>ValueSource</code>
- /// over relevance scores
- /// </summary>
- protected ValueSource GetScoreValueSource()
+ /// <summary>
+ /// Returns a <see cref="ValueSource"/> over relevance scores
+ /// </summary>
+ protected ValueSource GetScoreValueSource()
{
return new ScoreValueSource();
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8ade0b43/src/Lucene.Net.Expressions/Expression.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/Expression.cs b/src/Lucene.Net.Expressions/Expression.cs
index 5eadc60..88ef269 100644
--- a/src/Lucene.Net.Expressions/Expression.cs
+++ b/src/Lucene.Net.Expressions/Expression.cs
@@ -23,23 +23,23 @@ namespace Lucene.Net.Expressions
/// <summary>Base class that computes the value of an expression for a document.</summary>
/// <remarks>
/// Base class that computes the value of an expression for a document.
- /// <p>
+ /// <para/>
/// Example usage:
- /// <pre class="prettyprint">
+ /// <code>
/// // compile an expression:
- /// Expression expr = JavascriptCompiler.compile("sqrt(_score) + ln(popularity)");
+ /// Expression expr = JavascriptCompiler.Compile("sqrt(_score) + ln(popularity)");
/// // SimpleBindings just maps variables to SortField instances
/// SimpleBindings bindings = new SimpleBindings();
- /// bindings.add(new SortField("_score", SortField.Type.SCORE));
- /// bindings.add(new SortField("popularity", SortField.Type.INT));
+ /// bindings.Add(new SortField("_score", SortFieldType.SCORE));
+ /// bindings.Add(new SortField("popularity", SortFieldType.INT));
/// // create a sort field and sort by it (reverse order)
- /// Sort sort = new Sort(expr.getSortField(bindings, true));
+ /// Sort sort = new Sort(expr.GetSortField(bindings, true));
/// Query query = new TermQuery(new Term("body", "contents"));
- /// searcher.search(query, null, 10, sort);
- /// </pre>
+ /// searcher.Search(query, null, 10, sort);
+ /// </code>
+ /// @lucene.experimental
/// </remarks>
- /// <seealso cref="Lucene.Net.Expressions.JS.JavascriptCompiler.Compile(string)">Lucene.Net.Expressions.JS.JavascriptCompiler.Compile(string)</seealso>
- /// <lucene.experimental></lucene.experimental>
+ /// <seealso cref="Lucene.Net.Expressions.JS.JavascriptCompiler.Compile(string)"/>
public abstract class Expression
{
/// <summary>The original source text</summary>
@@ -49,13 +49,11 @@ namespace Lucene.Net.Expressions
public readonly string[] variables; // LUCENENET TODO: Make property
/// <summary>
- /// Creates a new
- /// <code>Expression</code>
- /// .
+ /// Creates a new <see cref="Expression"/>.
/// </summary>
/// <param name="sourceText">
/// Source text for the expression: e.g.
- /// <code>ln(popularity)</code>
+ /// <c>ln(popularity)</c>
/// </param>
/// <param name="variables">
/// Names of external variables referred to by the expression
@@ -69,22 +67,16 @@ namespace Lucene.Net.Expressions
/// <summary>Evaluates the expression for the given document.</summary>
/// <remarks>Evaluates the expression for the given document.</remarks>
- /// <param name="document"><code>docId</code> of the document to compute a value for</param>
+ /// <param name="document"><c>docId</c> of the document to compute a value for</param>
/// <param name="functionValues">
- ///
- /// <see cref="Lucene.Net.Queries.Function.FunctionValues">Lucene.Net.Queries.Function.FunctionValues
- /// </see>
- /// for each element of
- /// <see cref="variables">variables</see>
- /// .
+ /// <see cref="Lucene.Net.Queries.Function.FunctionValues"/>
+ /// for each element of <see cref="variables">variables</see>.
/// </param>
/// <returns>The computed value of the expression for the given document.</returns>
public abstract double Evaluate(int document, FunctionValues[] functionValues);
- /// <summary>Get a value source which can compute the value of this expression in the context of the given bindings.
- /// </summary>
- /// <remarks>Get a value source which can compute the value of this expression in the context of the given bindings.
- /// </remarks>
+ /// <summary>Get a value source which can compute the value of this expression in the context of the given bindings.</summary>
+ /// <remarks>Get a value source which can compute the value of this expression in the context of the given bindings.</remarks>
/// <param name="bindings">Bindings to use for external values in this expression</param>
/// <returns>A value source which will evaluate this expression when used</returns>
public virtual ValueSource GetValueSource(Bindings bindings)
@@ -92,19 +84,15 @@ namespace Lucene.Net.Expressions
return new ExpressionValueSource(bindings, this);
}
- /// <summary>Get a sort field which can be used to rank documents by this expression.
- /// </summary>
- /// <remarks>Get a sort field which can be used to rank documents by this expression.
- /// </remarks>
+ /// <summary>Get a sort field which can be used to rank documents by this expression.</summary>
+ /// <remarks>Get a sort field which can be used to rank documents by this expression.</remarks>
public virtual SortField GetSortField(Bindings bindings, bool reverse)
{
return GetValueSource(bindings).GetSortField(reverse);
}
/// <summary>
- /// Get a
- /// <see cref="Lucene.Net.Search.Rescorer">Lucene.Net.Search.Rescorer</see>
- /// , to rescore first-pass hits
+ /// Get a <see cref="Lucene.Net.Search.Rescorer"/>, to rescore first-pass hits
/// using this expression.
/// </summary>
public virtual Rescorer GetRescorer(Bindings bindings)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8ade0b43/src/Lucene.Net.Expressions/ExpressionFunctionValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ExpressionFunctionValues.cs b/src/Lucene.Net.Expressions/ExpressionFunctionValues.cs
index b6de614..453e066 100644
--- a/src/Lucene.Net.Expressions/ExpressionFunctionValues.cs
+++ b/src/Lucene.Net.Expressions/ExpressionFunctionValues.cs
@@ -22,10 +22,7 @@ namespace Lucene.Net.Expressions
*/
/// <summary>
- /// A
- /// <see cref="Lucene.Net.Queries.Function.FunctionValues">Lucene.Net.Queries.Function.FunctionValues
- /// </see>
- /// which evaluates an expression
+ /// A <see cref="Lucene.Net.Queries.Function.FunctionValues"/> which evaluates an expression
/// </summary>
internal class ExpressionFunctionValues : DoubleDocValues
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8ade0b43/src/Lucene.Net.Expressions/ExpressionRescorer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ExpressionRescorer.cs b/src/Lucene.Net.Expressions/ExpressionRescorer.cs
index 78ef4f5..bd3de3e 100644
--- a/src/Lucene.Net.Expressions/ExpressionRescorer.cs
+++ b/src/Lucene.Net.Expressions/ExpressionRescorer.cs
@@ -23,32 +23,22 @@ namespace Lucene.Net.Expressions
*/
/// <summary>
- /// A
- /// <see cref="Lucene.Net.Search.Rescorer">Lucene.Net.Search.Rescorer</see>
- /// that uses an expression to re-score
+ /// A <see cref="Lucene.Net.Search.Rescorer"/> that uses an expression to re-score
/// first pass hits. Functionally this is the same as
- /// <see cref="Lucene.Net.Search.SortRescorer">Lucene.Net.Search.SortRescorer
- /// </see>
- /// (if you build the
- /// <see cref="Lucene.Net.Search.Sort">Lucene.Net.Search.Sort</see>
- /// using
- /// <see cref="Expression.GetSortField(Bindings, bool)">Expression.GetSortField(Bindings, bool)
- /// </see>
- /// ), except for the explain method
+ /// <see cref="Lucene.Net.Search.SortRescorer"/> (if you build the
+ /// <see cref="Lucene.Net.Search.Sort"/> using
+ /// <see cref="Expression.GetSortField(Bindings, bool)"/>), except for the <see cref="Explain"/> method
/// which gives more detail by showing the value of each
/// variable.
+ /// @lucene.experimental
/// </summary>
- /// <lucene.experimental></lucene.experimental>
internal class ExpressionRescorer : SortRescorer
{
private readonly Expression expression;
private readonly Bindings bindings;
/// <summary>
- /// Uses the provided
- /// <see cref="Lucene.Net.Queries.Function.ValueSource">Lucene.Net.Queries.Function.ValueSource
- /// </see>
- /// to assign second
+ /// Uses the provided <see cref="Lucene.Net.Queries.Function.ValueSource"/> to assign second
/// pass scores.
/// </summary>
public ExpressionRescorer(Expression expression, Bindings bindings)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8ade0b43/src/Lucene.Net.Expressions/ExpressionSortField.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ExpressionSortField.cs b/src/Lucene.Net.Expressions/ExpressionSortField.cs
index d09bcfd..e596bfc 100644
--- a/src/Lucene.Net.Expressions/ExpressionSortField.cs
+++ b/src/Lucene.Net.Expressions/ExpressionSortField.cs
@@ -21,10 +21,7 @@ namespace Lucene.Net.Expressions
*/
/// <summary>
- /// A
- /// <see cref="Lucene.Net.Search.SortField">Lucene.Net.Search.SortField
- /// </see>
- /// which sorts documents by the evaluated value of an expression for each document
+ /// A <see cref="Lucene.Net.Search.SortField"/> which sorts documents by the evaluated value of an expression for each document
/// </summary>
internal class ExpressionSortField : SortField
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8ade0b43/src/Lucene.Net.Expressions/ExpressionValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ExpressionValueSource.cs b/src/Lucene.Net.Expressions/ExpressionValueSource.cs
index 254ec77..897b5bc 100644
--- a/src/Lucene.Net.Expressions/ExpressionValueSource.cs
+++ b/src/Lucene.Net.Expressions/ExpressionValueSource.cs
@@ -26,14 +26,8 @@ namespace Lucene.Net.Expressions
*/
/// <summary>
- /// A
- /// <see cref="Lucene.Net.Queries.Function.ValueSource">Lucene.Net.Queries.Function.ValueSource
- /// </see>
- /// which evaluates a
- /// <see cref="Expression">Expression</see>
- /// given the context of an
- /// <see cref="Bindings">Bindings</see>
- /// .
+ /// A <see cref="Lucene.Net.Queries.Function.ValueSource"/> which evaluates a
+ /// <see cref="Expression"/> given the context of an <see cref="Bindings"/>.
/// </summary>
internal sealed class ExpressionValueSource : ValueSource
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8ade0b43/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs b/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
index 7706baa..550d756 100644
--- a/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
+++ b/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
@@ -38,38 +38,29 @@ namespace Lucene.Net.Expressions.JS
/// <summary>An expression compiler for javascript expressions.</summary>
/// <remarks>
/// An expression compiler for javascript expressions.
- /// <p/>
+ /// <para/>
/// Example:
- /// <pre class="prettyprint">
- /// Expression foo = JavascriptCompiler.compile("((0.3*popularity)/10.0)+(0.7*score)");
- /// </pre>
- /// <p/>
- /// See the
- /// <see cref="Lucene.Net.Expressions.JS">package documentation</see>
- /// for
+ /// <code>
+ /// Expression foo = JavascriptCompiler.Compile("((0.3*popularity)/10.0)+(0.7*score)");
+ /// </code>
+ /// <para/>
+ /// See the <see cref="Lucene.Net.Expressions.JS">package documentation</see> for
/// the supported syntax and default functions.
- /// <p>
- /// You can compile with an alternate set of functions via
- /// <see Compile(string, System.Collections.Generic.IDictionary<K, V>>
- /// <cref xml:space="preserve">Compile(string, System.Collections.Generic.IDictionary{K, V})
- /// </cref>
- ///
- /// </see>
- /// .
+ /// <para>
+ /// You can compile with an alternate set of functions via <see cref="Compile(string, IDictionary{string, MethodInfo})"/>.
/// For example:
- /// <pre class="prettyprint">
- /// Map<String,Method> functions = new HashMap<String,Method>();
+ /// <code>
+ /// IDictionary<string, MethodInfo> functions = new Dictionary<string, MethodInfo>();
/// // add all the default functions
- /// functions.putAll(JavascriptCompiler.DEFAULT_FUNCTIONS);
- /// // add cbrt()
- /// functions.put("cbrt", Math.class.getMethod("cbrt", double.class));
+ /// functions.PutAll(JavascriptCompiler.DEFAULT_FUNCTIONS);
+ /// // add sqrt()
+ /// functions.Put("sqrt", (typeof(Math)).GetMethod("Sqrt", new Type[] { typeof(double) }));
/// // call compile with customized function map
- /// Expression foo = JavascriptCompiler.compile("cbrt(score)+ln(popularity)",
- /// functions,
- /// getClass().getClassLoader());
- /// </pre></p>
+ /// Expression foo = JavascriptCompiler.Compile("sqrt(score)+ln(popularity)", functions);
+ /// </code>
+ /// </para>
+ /// @lucene.experimental
/// </remarks>
- /// <lucene.experimental></lucene.experimental>
public class JavascriptCompiler
{
@@ -110,10 +101,8 @@ namespace Lucene.Net.Expressions.JS
/// <summary>The default set of functions available to expressions.</summary>
/// <remarks>
/// The default set of functions available to expressions.
- /// <p>
- /// See the
- /// <see cref="Lucene.Net.Expressions.JS">package documentation</see>
- /// for a list.
+ /// <para/>
+ /// See the <see cref="Lucene.Net.Expressions.JS">package documentation</see> for a list.
/// </remarks>
public static readonly IDictionary<string, MethodInfo> DEFAULT_FUNCTIONS;
@@ -126,10 +115,9 @@ namespace Lucene.Net.Expressions.JS
// This maximum length is theoretically 65535 bytes, but as its CESU-8 encoded we dont know how large it is in bytes, so be safe
// rcmuir: "If your ranking function is that large you need to check yourself into a mental institution!"
/// <summary>Compiles the given expression.</summary>
- /// <remarks>Compiles the given expression.</remarks>
/// <param name="sourceText">The expression to compile</param>
/// <returns>A new compiled expression</returns>
-
+ /// <exception cref="ParseException">on failure to compile</exception>
public static Expression Compile(string sourceText)
{
return new JavascriptCompiler(sourceText).CompileExpression();
@@ -138,28 +126,14 @@ namespace Lucene.Net.Expressions.JS
/// <summary>Compiles the given expression with the supplied custom functions.</summary>
/// <remarks>
/// Compiles the given expression with the supplied custom functions.
- /// <p>
- /// Functions must be
- /// <code>public static</code>
- /// , return
- /// <code>double</code>
- /// and
- /// can take from zero to 256
- /// <code>double</code>
- /// parameters.
+ /// <para/>
+ /// Functions must be <c>public static</c>, return <see cref="double"/> and
+ /// can take from zero to 256 <see cref="double"/> parameters.
/// </remarks>
/// <param name="sourceText">The expression to compile</param>
- /// <param name="functions">map of String names to functions</param>
- /// <param name="parent">
- /// a
- /// <code>ClassLoader</code>
- /// that should be used as the parent of the loaded class.
- /// It must contain all classes referred to by the given
- /// <code>functions</code>
- /// .
- /// </param>
+ /// <param name="functions">map of <see cref="string"/> names to functions</param>
/// <returns>A new compiled expression</returns>
-
+ /// <exception cref="ParseException">on failure to compile</exception>
public static Expression Compile(string sourceText, IDictionary<string, MethodInfo> functions)
{
foreach (MethodInfo m in functions.Values)
@@ -169,12 +143,11 @@ namespace Lucene.Net.Expressions.JS
return new JavascriptCompiler(sourceText, functions).CompileExpression();
}
- /// <summary>This method is unused, it is just here to make sure that the function signatures don't change.
- /// </summary>
+ /// <summary>This method is unused, it is just here to make sure that the function signatures don't change.</summary>
/// <remarks>
/// This method is unused, it is just here to make sure that the function signatures don't change.
/// If this method fails to compile, you also have to change the byte code generator to correctly
- /// use the FunctionValues class.
+ /// use the <see cref="FunctionValues"/> class.
/// </remarks>
private static void UnusedTestCompile()
{
@@ -183,7 +156,6 @@ namespace Lucene.Net.Expressions.JS
}
/// <summary>Constructs a compiler for expressions.</summary>
-
/// <param name="sourceText">The expression to compile</param>
private JavascriptCompiler(string sourceText)
: this(sourceText, DEFAULT_FUNCTIONS)
@@ -204,7 +176,7 @@ namespace Lucene.Net.Expressions.JS
/// <summary>Compiles the given expression with the specified parent classloader</summary>
/// <returns>A new compiled expression</returns>
-
+ /// <exception cref="ParseException">on failure to compile</exception>
private Expression CompileExpression()
{
try
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8ade0b43/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ScoreFunctionValues.cs b/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
index 331bebb..0dfd838 100644
--- a/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
+++ b/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
@@ -25,9 +25,7 @@ namespace Lucene.Net.Expressions
/// <summary>
/// A utility class to allow expressions to access the score as a
- /// <see cref="Lucene.Net.Queries.Function.FunctionValues">Lucene.Net.Queries.Function.FunctionValues
- /// </see>
- /// .
+ /// <see cref="Lucene.Net.Queries.Function.FunctionValues"/>.
/// </summary>
internal class ScoreFunctionValues : DoubleDocValues
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8ade0b43/src/Lucene.Net.Expressions/ScoreValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ScoreValueSource.cs b/src/Lucene.Net.Expressions/ScoreValueSource.cs
index 2b06093..f825663 100644
--- a/src/Lucene.Net.Expressions/ScoreValueSource.cs
+++ b/src/Lucene.Net.Expressions/ScoreValueSource.cs
@@ -24,22 +24,15 @@ namespace Lucene.Net.Expressions
*/
/// <summary>
- /// A
- /// <see cref="Lucene.Net.Queries.Function.ValueSource">Lucene.Net.Queries.Function.ValueSource
- /// </see>
- /// which uses the
- /// <see cref="Lucene.Net.Search.Scorer">Lucene.Net.Search.Scorer</see>
- /// passed through
- /// the context map by
- /// <see cref="ExpressionComparer">ExpressionComparer</see>
- /// .
+ /// A <see cref="Lucene.Net.Queries.Function.ValueSource"/> which uses the
+ /// <see cref="Lucene.Net.Search.Scorer"/> passed through
+ /// the context map by <see cref="ExpressionComparer"/>.
/// </summary>
internal class ScoreValueSource : ValueSource
{
/// <summary>
- /// <code>context</code> must contain a key "scorer" which is a
- /// <see cref="Lucene.Net.Search.Scorer">Lucene.Net.Search.Scorer</see>
- /// .
+ /// <paramref name="context"/> must contain a key "scorer" which is a
+ /// <see cref="Lucene.Net.Search.Scorer"/>.
/// </summary>
/// <exception cref="System.IO.IOException"></exception>
public override FunctionValues GetValues(IDictionary context, AtomicReaderContext
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8ade0b43/src/Lucene.Net.Expressions/SimpleBindings.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/SimpleBindings.cs b/src/Lucene.Net.Expressions/SimpleBindings.cs
index af06d6f..b1f65f0 100644
--- a/src/Lucene.Net.Expressions/SimpleBindings.cs
+++ b/src/Lucene.Net.Expressions/SimpleBindings.cs
@@ -25,27 +25,23 @@ namespace Lucene.Net.Expressions
/// <summary>
/// Simple class that binds expression variable names to
- /// <see cref="Lucene.Net.Search.SortField">Lucene.Net.Search.SortField
- /// </see>
- /// s
- /// or other
- /// <see cref="Expression">Expression</see>
- /// s.
- /// <p>
+ /// <see cref="Lucene.Net.Search.SortField"/>s or other
+ /// <see cref="Expression"/>s.
+ /// <para/>
/// Example usage:
- /// <pre class="prettyprint">
+ /// <code>
/// SimpleBindings bindings = new SimpleBindings();
/// // document's text relevance score
- /// bindings.add(new SortField("_score", SortField.Type.SCORE));
+ /// bindings.Add(new SortField("_score", SortFieldType.SCORE));
/// // integer NumericDocValues field (or from FieldCache)
- /// bindings.add(new SortField("popularity", SortField.Type.INT));
+ /// bindings.Add(new SortField("popularity", SortFieldType.INT));
/// // another expression
- /// bindings.add("recency", myRecencyExpression);
+ /// bindings.Add("recency", myRecencyExpression);
/// // create a sort field in reverse order
- /// Sort sort = new Sort(expr.getSortField(bindings, true));
- /// </pre>
+ /// Sort sort = new Sort(expr.GetSortField(bindings, true));
+ /// </code>
+ /// @lucene.experimental
/// </summary>
- /// <lucene.experimental></lucene.experimental>
public sealed class SimpleBindings : Bindings
{
internal readonly IDictionary<string, object> map = new Dictionary<string, object>();
@@ -55,10 +51,10 @@ namespace Lucene.Net.Expressions
/// </summary>
public SimpleBindings() { }
- /// <summary>Adds a SortField to the bindings.</summary>
+ /// <summary>Adds a <see cref="SortField"/> to the bindings.</summary>
/// <remarks>
- /// Adds a SortField to the bindings.
- /// <p>
+ /// Adds a <see cref="SortField"/> to the bindings.
+ /// <para/>
/// This can be used to reference a DocValuesField, a field from
/// FieldCache, the document's score, etc.
/// </remarks>
@@ -67,10 +63,10 @@ namespace Lucene.Net.Expressions
map[sortField.Field] = sortField;
}
- /// <summary>Adds an Expression to the bindings.</summary>
+ /// <summary>Adds an <see cref="Expression"/> to the bindings.</summary>
/// <remarks>
- /// Adds an Expression to the bindings.
- /// <p>
+ /// Adds an <see cref="Expression"/> to the bindings.
+ /// <para/>
/// This can be used to reference expressions from other expressions.
/// </remarks>
public void Add(string name, Expression expression)
@@ -126,8 +122,7 @@ namespace Lucene.Net.Expressions
}
}
- /// <summary>Traverses the graph of bindings, checking there are no cycles or missing references
- /// </summary>
+ /// <summary>Traverses the graph of bindings, checking there are no cycles or missing references</summary>
/// <exception cref="System.ArgumentException">if the bindings is inconsistent</exception>
public void Validate()
{