Azure AI 검색의 OData 식 구문 참조

메모

Azure AI 검색 Azure 포털, REST API 및 Azure SDK 통해 사용할 수 있습니다. 또한 엔터프라이즈 콘텐츠를 Microsoft Foundry 포털의 에이전트에 대해 재사용 가능한 사용 권한 인식 기술 자료로 변환하는 관리되는 기술 계층인 Foundry IQ를 뒷받침합니다.

Azure AI 검색는 API 전체에서 OData 식을 매개 변수로 사용합니다. 대체로 OData 식은 $orderby 및 $filter 매개 변수에 사용됩니다. 이러한 식은 여러 절, 함수 및 연산자를 포함하는 복잡할 수 있습니다. 그러나 속성 경로와 같은 간단한 OData 식도 Azure AI 검색 REST API의 많은 부분에서 사용됩니다. 예를 들어 경로 식은 제안기, 채점 함수, $select 매개 변수 또는 Lucene 쿼리의 필드 지정 검색에서 하위 필드를 나열하는 경우와 같이 API 전체에서 복합 필드의 하위 필드를 참조하는 데 사용됩니다.

이 문서에서는 정식 문법을 사용하여 이러한 모든 형태의 OData 식을 설명합니다. 문법을 시각적으로 탐색하는 데 도움이 되는 대화형 다이어그램 도 있습니다.

정식 문법

EBNF(Extended Backus-Naur Form) 문법을 사용하여 Azure AI 검색에서 지원하는 OData 언어의 하위 집합을 설명할 수 있습니다. 규칙은 가장 복잡한 식부터 시작하여 더 많은 기본 식으로 구분하여 "하향식"으로 나열됩니다. 맨 위에는 Azure AI 검색 REST API의 특정 매개 변수에 해당하는 문법 규칙이 있습니다.

  • $filter은 규칙에 의해 정의되어 있습니다 filter_expression .
  • $orderby은 규칙에 의해 정의되어 있습니다 order_by_expression .
  • $select은 규칙에 의해 정의되어 있습니다 select_expression .
  • 규칙에 의해 정의된 field_path 필드 경로입니다. 필드 경로는 API 전체에서 사용됩니다. 인덱스의 최상위 필드 또는 하나 이상의 복합 필드 상위 항목이 있는 하위 필드를 참조할 수 있습니다.

EBNF 뒤에는 문법과 해당 규칙 간 관계를 대화형으로 살펴볼 수 있는 검색 가능한 구문 다이어그램이 있습니다.

/* Top-level rules */

filter_expression ::= boolean_expression

order_by_expression ::= order_by_clause(',' order_by_clause)*

select_expression ::= '*' | field_path(',' field_path)*

field_path ::= identifier('/'identifier)*


/* Shared base rules */

identifier ::= [a-zA-Z_][a-zA-Z_0-9]*


/* Rules for $orderby */

order_by_clause ::= (field_path | sortable_function) ('asc' | 'desc')?

sortable_function ::= geo_distance_call | 'search.score()'


/* Rules for $filter */

boolean_expression ::=
    collection_filter_expression
    | logical_expression
    | comparison_expression
    | boolean_literal
    | boolean_function_call
    | '(' boolean_expression ')'
    | variable

/* This can be a range variable in the case of a lambda, or a field path. */
variable ::= identifier | field_path

collection_filter_expression ::=
    field_path'/all(' lambda_expression ')'
    | field_path'/any(' lambda_expression ')'
    | field_path'/any()'

lambda_expression ::= identifier ':' boolean_expression

logical_expression ::=
    boolean_expression ('and' | 'or') boolean_expression
    | 'not' boolean_expression

comparison_expression ::= 
    variable_or_function comparison_operator constant | 
    constant comparison_operator variable_or_function

variable_or_function ::= variable | function_call

comparison_operator ::= 'gt' | 'lt' | 'ge' | 'le' | 'eq' | 'ne'


/* Rules for constants and literals */

constant ::=
    string_literal
    | date_time_offset_literal
    | integer_literal
    | float_literal
    | boolean_literal
    | 'null'

string_literal ::= "'"([^'] | "''")*"'"

date_time_offset_literal ::= date_part'T'time_part time_zone

date_part ::= year'-'month'-'day

time_part ::= hour':'minute(':'second('.'fractional_seconds)?)?

zero_to_fifty_nine ::= [0-5]digit

digit ::= [0-9]

year ::= digit digit digit digit

month ::= '0'[1-9] | '1'[0-2]

day ::= '0'[1-9] | [1-2]digit | '3'[0-1]

hour ::= [0-1]digit | '2'[0-3]

minute ::= zero_to_fifty_nine

second ::= zero_to_fifty_nine

fractional_seconds ::= integer_literal

time_zone ::= 'Z' | sign hour':'minute

sign ::= '+' | '-'

/* In practice integer literals are limited in length to the precision of
the corresponding EDM data type. */
integer_literal ::= sign? digit+

float_literal ::=
    sign? whole_part fractional_part? exponent?
    | 'NaN'
    | '-INF'
    | 'INF'

whole_part ::= integer_literal

fractional_part ::= '.'integer_literal

exponent ::= 'e' sign? integer_literal

boolean_literal ::= 'true' | 'false'


/* Rules for functions */

function_call ::=
    geo_distance_call |
    boolean_function_call

geo_distance_call ::=
    'geo.distance(' variable ',' geo_point ')'
    | 'geo.distance(' geo_point ',' variable ')'

geo_point ::= "geography'POINT(" lon_lat ")'"

lon_lat ::= float_literal ' ' float_literal

boolean_function_call ::=
    geo_intersects_call |
    search_in_call |
    search_is_match_call

geo_intersects_call ::=
    'geo.intersects(' variable ',' geo_polygon ')'

/* You need at least four points to form a polygon, where the first and
last points are the same. */
geo_polygon ::=
    "geography'POLYGON((" lon_lat ',' lon_lat ',' lon_lat ',' lon_lat_list "))'"

lon_lat_list ::= lon_lat(',' lon_lat)*

search_in_call ::=
    'search.in(' variable ',' string_literal(',' string_literal)? ')'

/* Note that it is illegal to call search.ismatch or search.ismatchscoring
from inside a lambda expression. */
search_is_match_call ::=
    'search.ismatch'('scoring')?'(' search_is_match_parameters ')'

search_is_match_parameters ::=
    string_literal(',' string_literal(',' query_type ',' search_mode)?)?

query_type ::= "'full'" | "'simple'"

search_mode ::= "'any'" | "'all'"

구문 다이어그램

Azure AI 검색에서 지원하는 OData 언어 문법을 시각적으로 탐색하려면 대화형 구문 다이어그램을 사용해 보세요.

다음 항목 참고하기