Sets a filter for the attribute with the given name.

Namespace: Gronewold.SphinxConnector
Assembly: Gronewold.SphinxConnector (in Gronewold.SphinxConnector.dll) Version: 2.8.0.26312 (2.8.0.26312)

Syntax

C#
public void SetFilter<TFilterable>(
	string attributeName,
	params TFilterable[] value
)
where TFilterable : IFilterableType
Visual Basic
Public Sub SetFilter(Of TFilterable As IFilterableType) ( _
	attributeName As String, _
	ParamArray value As TFilterable() _
)

Parameters

attributeName
Type: System..::..String
The name of the attribute to filter on.
value
Type: array<TFilterable>[]()[][]
The value for the filter.

Type Parameters

TFilterable
The type to set a filter for.

Examples

The following example shows how to filter films based on the actor_id attribute. The filter will match any films with actor_id equal to 35 OR 28.
CopyC#
SphinxClient sphinxClient = new SphinxClient();
sphinxClient.SearchOptions.SetFilter<SphinxInteger>("actor_id", 35, 28);

SphinxSearchResult searchResult = sphinxClient.Query("room", "sakila");

foreach (SphinxMatch sphinxMatch in searchResult.Matches)
{
    Console.WriteLine(sphinxMatch);
}
If you wanted to retrieve all films with actor_id equal to 35 AND 28, you would call the SetFilter method like this:
CopyC#
sphinxClient.SearchOptions.SetFilter<SphinxInteger>("actor_id", 35);
sphinxClient.SearchOptions.SetFilter<SphinxInteger>("actor_id", 28);

Exceptions

ExceptionCondition
System..::..ArgumentNullExceptionattributeName or value is null.
System..::..ArgumentExceptionattributeName is empty.

See Also