Click or drag to resize

Projection Class

Provides methods to project properties into new values. The methods are intended to be used with the methods provided by the IFulltextQueryTDocument interface.
Inheritance Hierarchy
SystemObject
  SphinxConnector.FluentApiProjection

Namespace:  SphinxConnector.FluentApi
Assembly:  SphinxConnector (in SphinxConnector.dll) Version: 5.3.0
Syntax
public static class Projection

The Projection type exposes the following members.

Methods
  NameDescription
Public methodStatic memberAvgTSource
Computes the average of a sequence of values.
Public methodStatic memberCount
Computes the number of occurences of a value in a sequence of values.
Public methodStatic memberCountTResult
Computes the number of occurences of a value in a sequence of values.
Public methodStatic memberCountDistinctTSource
Computes the number of distinct occurences of a value in a sequence of values.
Public methodStatic memberMaxTResult
Computes the maximum of a sequence of values.
Public methodStatic memberMinTResult
Computes the minimum of a sequence of values.
Public methodStatic memberSumTResult
Computes the sum of a sequence of values.
Top
Examples
Suppose you have the following class representing a document in your index:
The following code computes the number of products in a category that match a query:
using (IFulltextSession fulltextSession = fulltextStore.StartSession())
{
    var results = fulltextSession.Query<Product>().
                                  Match("a query").
                                  GroupBy(p => p.CategoryId).
                                  Select(p => new
                                  {
                                      p.CategoryId,
                                      ProductsInCategory = Projection.Count()
                                  }).
                                  ToList();
}
See Also