Click or drag to resize

SphinxSearchOptionsSetFilterRangeTRangeFilterable Method

Sets a range filter for the attribute with the given attribute name.

Namespace:  SphinxConnector.NativeApi
Assembly:  SphinxConnector (in SphinxConnector.dll) Version: 5.3.0
Syntax
public void SetFilterRange<TRangeFilterable>(
	string attributeName,
	TRangeFilterable min,
	TRangeFilterable max,
	bool exclude = false
)
where TRangeFilterable : IRangeFilterableType

Parameters

attributeName
Type: SystemString
The name of the attribute to filter on.
min
Type: TRangeFilterable
The mininum value for the attribute.
max
Type: TRangeFilterable
The maximum value for the attribute.
exclude (Optional)
Type: SystemBoolean
if set to true excludes the matching documents from the result.

Type Parameters

TRangeFilterable
The type to filter on.
Exceptions
ExceptionCondition
ArgumentExceptionattributeName is empty or min is not less or equal to max.
ArgumentNullExceptionattributeName is null.
NotSupportedException Either attributes of type TRangeFilterable are not supported in Version or the type can not have a range filter applied.
Examples
SphinxClient sphinxClient = new SphinxClient();
sphinxClient.SearchOptions.SetFilterRange<SphinxFloat>("rental_rate", 0, 0.99f);

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

foreach (SphinxMatch sphinxMatch in searchResult.Matches)
{
    Console.WriteLine(sphinxMatch);
}
See Also