コード例 #1
0
 /// <summary>
 /// Uses the provided
 /// <see cref="Lucene.Net.Queries.Function.ValueSource">Lucene.Net.Queries.Function.ValueSource
 /// 	</see>
 /// to assign second
 /// pass scores.
 /// </summary>
 public ExpressionRescorer(Expression expression, Bindings bindings)
     : base(new Sort
         (expression.GetSortField(bindings, true)))
 {
     this.expression = expression;
     this.bindings = bindings;
 }
コード例 #2
0
		internal ExpressionValueSource(Bindings bindings, Expression expression)
		{
			if (bindings == null)
			{
				throw new ArgumentNullException();
			}
			if (expression == null)
			{
				throw new ArgumentNullException();
			}
			this.expression = expression;
			variables = new ValueSource[expression.variables.Length];
			bool needsScores = false;
			for (int i = 0; i < variables.Length; i++)
			{
				ValueSource source = bindings.GetValueSource(expression.variables[i]);
				if (source is ScoreValueSource)
				{
					needsScores = true;
				}
				else
				{
				    var valueSource = source as ExpressionValueSource;
				    if (valueSource != null)
					{
						if (valueSource.NeedsScores())
						{
							needsScores = true;
						}
					}
					else
					{
						if (source == null)
						{
							throw new SystemException("Internal error. Variable (" + expression.variables[i]
								 + ") does not exist.");
						}
					}
				}
			    variables[i] = source;
			}
			this.needsScores = needsScores;
		}
コード例 #3
0
ファイル: Expression.cs プロジェクト: Cefa68000/lucenenet
 /// <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);
 }
コード例 #4
0
ファイル: Expression.cs プロジェクト: Cefa68000/lucenenet
 /// <summary>
 /// Get a
 /// <see cref="Lucene.Net.Search.Rescorer">Lucene.Net.Search.Rescorer</see>
 /// , to rescore first-pass hits
 /// using this expression.
 /// </summary>
 public virtual Rescorer GetRescorer(Bindings bindings)
 {
     return new ExpressionRescorer(this, bindings);
 }
コード例 #5
0
ファイル: Expression.cs プロジェクト: Cefa68000/lucenenet
 /// <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)
 {
     return new ExpressionValueSource(bindings, this);
 }