Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class SimpleBindings

    Simple class that binds expression variable names to Lucene.Net.Search.SortFields or other Expressions.

    Example usage:
    SimpleBindings bindings = new SimpleBindings
    {
        // document's text relevance score
        new SortField("_score", SortFieldType.SCORE),
        // integer NumericDocValues field (or from FieldCache)
        new SortField("popularity", SortFieldType.INT),
        // another expression
        { "recency", myRecencyExpression },
    };
    // create a sort field in reverse order
    Sort sort = new Sort(expr.GetSortField(bindings, true));
    Note

    This API is experimental and might change in incompatible ways in the next release.

    Inheritance
    object
    Bindings
    SimpleBindings
    Implements
    IEnumerable<KeyValuePair<string, object>>
    IEnumerable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Expressions
    Assembly: Lucene.Net.Expressions.dll
    Syntax
    public sealed class SimpleBindings : Bindings, IEnumerable<KeyValuePair<string, object>>, IEnumerable

    Constructors

    SimpleBindings()

    Creates a new empty Bindings

    Declaration
    public SimpleBindings()

    Methods

    Add(SortField)

    Adds a Lucene.Net.Search.SortField to the bindings.

    Declaration
    public void Add(SortField sortField)
    Parameters
    Type Name Description
    SortField sortField
    Remarks

    Adds a Lucene.Net.Search.SortField to the bindings.

    This can be used to reference a DocValuesField, a field from FieldCache, the document's score, etc.

    Add(string, Expression)

    Adds an Expression to the bindings.

    Declaration
    public void Add(string name, Expression expression)
    Parameters
    Type Name Description
    string name
    Expression expression
    Remarks

    Adds an Expression to the bindings.

    This can be used to reference expressions from other expressions.

    GetValueSource(string)

    Returns a Lucene.Net.Queries.Function.ValueSource bound to the variable name.

    Declaration
    public override ValueSource GetValueSource(string name)
    Parameters
    Type Name Description
    string name
    Returns
    Type Description
    ValueSource
    Overrides
    Bindings.GetValueSource(string)

    Validate()

    Traverses the graph of bindings, checking there are no cycles or missing references

    Declaration
    public void Validate()
    Exceptions
    Type Condition
    ArgumentException

    if the bindings is inconsistent

    Implements

    IEnumerable<T>
    IEnumerable
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.