Hoodlum
Hoodlum

Reputation: 1503

Why does it throw Invalid expression exception for Azure search

I receive this

Invalid expression: Syntax error at position 8 in '$filter=search.in(Categories, 'Career Resources', ',')'. Parameter name: $filter

exception when performing a search in Azure.

Here is the code snippet by itself

$filter=search.in(Categories, 'Career Resources', ',')

Can anyone tell me why?

Upvotes: 0

Views: 1499

Answers (2)

Hoodlum
Hoodlum

Reputation: 1503

I ended up solving the problem by using a completely different syntax:

"Categories/any(f: f eq 'Career Resources')"

Upvotes: 1

amsop
amsop

Reputation: 18

The search.in function got two overloads:

  1. search.in(variable, valueList)
  2. search.in(variable, valueList, delimiters)

so in you are case,

  1. if you are searching for "Career Resources" then syntax will be

      $filter=search.in(Categories, 'Career Resources')
    
  2. And if you are searching for "Career" or "Resources" then syntax will be

     $filter=search.in(Categories, 'Career,Resources' ',')
    

Upvotes: 0

Related Questions