Search code examples
azuresearchodataazure-cognitive-searchazure-search-.net-sdk

Azure Search Service search integers


Providing you have a simple index:

public partial class SomeIndex
{
    [Key]
    [IsFilterable]
    public string Id{ get; set; }

    [IsSearchable, IsFilterable, IsSortable]
    public string Name{ get; set; }

    [IsFilterable, IsSortable]
    public int SomeNumber { get; set; }

How do I search the exact number matches for SomeNumber int?

'eq' doesn't apply here.

Any advice appreciated. Thank you.


Solution

  • You can use a filter. 'eq' works perfectly.

    The filter query will be 'Field name eq number'

    The only constraint is that the field must be filterable