SphinxSearchOptionsSetFilterRangeTRangeFilterable Method |
Namespace: SphinxConnector.NativeApi
public void SetFilterRange<TRangeFilterable>( string attributeName, TRangeFilterable min, TRangeFilterable max, bool exclude = false ) where TRangeFilterable : IRangeFilterableType
| Exception | Condition |
|---|---|
| ArgumentException | attributeName is empty or min is not less or equal to max. |
| ArgumentNullException | attributeName is null. |
| NotSupportedException | Either attributes of type TRangeFilterable are not supported in Version or the type can not have a range filter applied. |
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); }