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.
Definition
Namespace: SphinxConnector.FluentApi
Assembly: SphinxConnector (in SphinxConnector.dll) Version: 6.1.0
Assembly: SphinxConnector (in SphinxConnector.dll) Version: 6.1.0
C#
public static class ProjectionVB
Public NotInheritable Class Projection- Inheritance
- Object Projection
Example
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:
C#
public class Product
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public decimal Price { get; set; }
public int CategoryId { get; set; }
public int VendorId { get; set; }
public int Weight { get; set; }
}
The following code computes the number of products in a category that match a query:
C#
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();
}Methods
| AvgTSource | Computes the average of a sequence of values. |
| Count | Computes the number of occurences of a value in a sequence of values. |
| CountTResult | Computes the number of occurences of a value in a sequence of values. |
| CountDistinctTSource | Computes the number of distinct occurences of a value in a sequence of values. |
| MaxTResult | Computes the maximum of a sequence of values. |
| MinTResult | Computes the minimum of a sequence of values. |
| SumTResult | Computes the sum of a sequence of values. |