Foundry IQ(Azure AI 검색)의 OData 전체 텍스트 검색 함수 - search.ismatch 및search.ismatchscoring

참고

Foundry IQ (Azure AI 검색)는 관리 검색을 위해 고급 수준의 지식 원본 API 및 지식 베이스 API와 함께 직접 인덱싱 및 쿼리 API를 제공합니다. Azure 포털, REST API 또는 Azure SDK 사용하여 이러한 기능을 구성하거나 Microsoft Foundry 포털의 기술 자료에 에이전트를 연결합니다.

Foundry IQ(Azure AI 검색)는 및 search.ismatch 함수를 통해 search.ismatchscoring의 컨텍스트에서 전체 텍스트 검색을 지원합니다. 이러한 함수를 사용하면 search의 최상위 매개 변수를 사용하는 것만으로는 할 수 없었던 방식으로, 전체 텍스트 검색을 엄격한 부울 필터링과 결합할 수 있습니다.

참고

search.ismatch 및 search.ismatchscoring 함수는 검색 API의 필터에서만 지원됩니다. 제안 또는 자동 완성 API에서는 지원되지 않습니다.

구문

다음 EBNF(Extended Backus-Naur Form)는 search.ismatch 및 search.ismatchscoring 함수의 문법을 정의합니다.

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'"

다음과 같은 대화형 구문 다이어그램도 사용할 수 있습니다.

참고

전체 EBNF 에 대한 Foundry IQ에 대한 OData 식 구문 참조 를 참조하세요.

search.ismatch

함수는 search.ismatch 전체 텍스트 검색 쿼리를 필터 식의 일부로 평가합니다. 일치하는 문서가 결과 집합에 반환됩니다. 이 함수의 다음 오버로드를 사용할 수 있습니다.

  • search.ismatch(search)
  • search.ismatch(search, searchFields)
  • search.ismatch(search, searchFields, queryType, searchMode)

매개 변수는 다음 표에 정의되어 있습니다.

매개 변수 이름 유형 설명
search Edm.String 검색 쿼리( 단순 또는 전체 Lucene 쿼리 구문)입니다.
searchFields Edm.String 검색할 검색 가능한 필드의 쉼표로 구분된 목록입니다. 는 인덱스의 모든 검색 가능한 필드로 기본 설정됩니다. 매개 변수에서 search을 사용하는 경우 Lucene 쿼리의 필드 지정자가 이 매개 변수에 지정된 모든 필드를 재정의합니다.
queryType Edm.String 'simple' 또는 'full'; 기본값은 .입니다 'simple'. 매개 변수에 사용된 쿼리 언어를 search 지정합니다.
searchMode Edm.String 'any' 또는 'all', 기본값은 .입니다 'any'. 문서를 일치 항목으로 계산하기 위해 매개 변수의 검색어 search 중 하나 또는 전체를 일치시켜야 하는지 여부를 나타냅니다. 매개 변수에서 Lucene 부울 연산자를search 사용하는 경우 이 매개 변수보다 우선합니다.

위의 모든 매개 변수는 Search API의 해당 검색 요청 매개 변수와 동일합니다.

함수 search.ismatch는 형식 Edm.Boolean의 값을 반환하며, 부울 논리 연산자를 사용해 다른 필터 하위 표현과 결합할 수 있습니다.

참고

Foundry IQ는 람다 식 내부에서 search.ismatch 또는 search.ismatchscoring 사용을 지원하지 않습니다. 즉, 전체 텍스트 검색 일치와 동일한 개체의 엄격한 필터 일치를 상호 연결할 수 있는 개체 컬렉션에 대한 필터를 작성할 수 없습니다. 이 제한 사항과 예제에 대한 자세한 내용은 Foundry IQ의 컬렉션 필터 문제 해결을 참조하세요. 이 제한 사항이 존재하는 이유에 대한 자세한 내용은 Foundry IQ의 컬렉션 필터 이해를 참조하세요.

search.ismatchscoring

search.ismatchscoring 함수와 마찬가지로 search.ismatch 함수는 매개 변수로 전달된 전체 텍스트 검색 쿼리와 일치하는 문서에 대해 true 반환합니다. 두 문서 간의 차이점은 쿼리와 일치하는 search.ismatchscoring 문서의 관련성 점수가 전체 문서 점수에 영향을 주지만 search.ismatch문서 점수는 변경되지 않는다는 것입니다. 이 함수의 다음 오버로드는 search.ismatch와 동일한 매개 변수로 사용할 수 있습니다.

  • search.ismatchscoring(search)
  • search.ismatchscoring(search, searchFields)
  • search.ismatchscoring(search, searchFields, queryType, searchMode)

search.ismatch 및 search.ismatchscoring 함수를 동일한 필터 식에서 모두 사용할 수 있습니다.

예제

"워터프론트"라는 단어가 있는 문서를 찾습니다. 이 필터 쿼리는 를 사용한 search=waterfront과 동일합니다.

    search.ismatchscoring('waterfront')

다음은 Azure Portal의 검색 탐색기에서 실행할 수 있는 이 요청에 대한 전체 쿼리 구문입니다. 출력은 해안가, 해안 및 가에 대한 일치 항목으로 구성됩니다.

{
  "search": "*",
  "select": "HotelId, HotelName, Description",
  "searchMode": "all",
  "queryType": "simple",
  "count": true,
  "filter": "search.ismatchscoring('waterfront')"
}

"pool"이라는 단어가 있고 등급이 4 이상인 문서 또는 "motel"이라는 단어가 3.2인 문서를 찾습니다. 이 요청은 search.ismatchscoring 함수 없이는 표현할 수 없습니다.

    search.ismatchscoring('pool') and Rating ge 4 or search.ismatchscoring('motel') and Rating eq 3.2

다음은 검색 탐색기에 대한 이 요청에 대한 전체 쿼리 구문입니다. 출력은 평점이 4보다 큰 수영장이 있는 호텔 또는 평점이 3.2와 같은 모텔의 일치 항목으로 구성됩니다.

{
  "search": "*",
  "select": "HotelId, HotelName, Description, Tags, Rating",
  "searchMode": "all",
  "queryType": "simple",
  "count": true,
  "filter": "search.ismatchscoring('pool') and Rating ge 4 or search.ismatchscoring('motel') and Rating eq 3.2"
}

"luxury"라는 단어가 없는 문서를 찾습니다.

    not search.ismatch('luxury')

다음은 이 요청에 대한 전체 쿼리 구문입니다. 출력은 럭셔리라는 용어에 대한 일치하는 결과로 구성됩니다.

{
  "search": "*",
  "select": "HotelId, HotelName, Description, Tags, Rating",
  "searchMode": "all",
  "queryType": "simple",
  "count": true,
  "filter": "not search.ismatch('luxury')"
}

"ocean" 또는 등급이 3.2인 문서를 찾습니다. 쿼리는 search.ismatchscoring 필드 HotelName 및 Description에 대해서만 실행됩니다.

다음은 이 요청에 대한 전체 쿼리 구문입니다. "또한, 논리합의 두 번째 절에만 해당하는 문서도 반환됩니다(특히 Rating가 3.2와 같은 호텔)." 해당 문서가 식의 점수가 매칭된 부분과 일치하지 않음을 분명히 하기 위해 점수가 0과 같은 상태로 반환됩니다.

{
  "search": "*",
  "select": "HotelId, HotelName, Description, Rating",
  "searchMode": "all",
  "queryType": "full",
  "count": true,
  "filter": "search.ismatchscoring('ocean', 'Description,HotelName') or Rating eq 3.2"
}

출력은 설명 또는 호텔 이름에 "ocean"을 언급하는 호텔 또는 평점이 3.2인 호텔 등 4개의 일치 항목으로 구성됩니다. 두 번째 절의 일치 항목에 대한 검색 점수는 0입니다.

{
  "@odata.count": 4,
  "value": [
    {
      "@search.score": 1.6076145,
      "HotelId": "18",
      "HotelName": "Ocean Water Resort & Spa",
      "Description": "New Luxury Hotel for the vacation of a lifetime. Bay views from every room, location near the pier, rooftop pool, waterfront dining & more.",
      "Rating": 4.2
    },
    {
      "@search.score": 1.0594962,
      "HotelId": "41",
      "HotelName": "Windy Ocean Motel",
      "Description": "Oceanfront hotel overlooking the beach features rooms with a private balcony and 2 indoor and outdoor pools. Inspired by the natural beauty of the island, each room includes an original painting of local scenes by the owner. Rooms include a mini fridge, Keurig coffee maker, and flatscreen TV. Various shops and art entertainment are on the boardwalk, just steps away.",
      "Rating": 3.5
    },
    {
      "@search.score": 0,
      "HotelId": "40",
      "HotelName": "Trails End Motel",
      "Description": "Only 8 miles from Downtown. On-site bar/restaurant, Free hot breakfast buffet, Free wireless internet, All non-smoking hotel. Only 15 miles from airport.",
      "Rating": 3.2
    },
    {
      "@search.score": 0,
      "HotelId": "26",
      "HotelName": "Planetary Plaza & Suites",
      "Description": "Extend Your Stay. Affordable home away from home, with amenities like free Wi-Fi, full kitchen, and convenient laundry service.",
      "Rating": 3.2
    }
  ]
}

"호텔"과 "공항"이라는 용어가 호텔 설명에서 서로 5단어 이내이고 적어도 일부 객실에서는 흡연이 허용되지 않는 문서를 찾아보세요.

    search.ismatch('"hotel airport"~5', 'Description', 'full', 'any') and Rooms/any(room: not room/SmokingAllowed)

전체 쿼리 구문은 다음과 같습니다. Search Explorer에서 실행하려면 백슬래시 문자로 내부 따옴표를 이스케이프하세요.

{
  "search": "*",
  "select": "HotelId, HotelName, Description, Tags, Rating",
  "searchMode": "all",
  "queryType": "simple",
  "count": true,
  "filter": "search.ismatch('\"hotel airport\"~5', 'Description', 'full', 'any') and Rooms/any(room: not room/SmokingAllowed)"
}

출력은 "hotel" 및 "airport"라는 용어가 5단어 이내인 단일 문서로 구성됩니다. 대부분의 호텔에서는 이 검색 결과에 포함된 객실을 포함하여 여러 객실에 흡연이 허용됩니다.

{
  "@odata.count": 1,
  "value": [
    {
      "@search.score": 1,
      "HotelId": "40",
      "HotelName": "Trails End Motel",
      "Description": "Only 8 miles from Downtown. On-site bar/restaurant, Free hot breakfast buffet, Free wireless internet, All non-smoking hotel. Only 15 miles from airport.",
      "Tags": [
        "bar",
        "free wifi",
        "restaurant"
      ],
      "Rating": 3.2
    }
  ]
}

설명 필드에서 문자 "lux"로 시작하는 단어가 있는 문서를 찾습니다. 이 쿼리는 접두사 검색과 search.ismatch을 함께 사용합니다.

    search.ismatch('lux*', 'Description')

전체 쿼리는 다음과 같습니다.

{
  "search": "*",
  "select": "HotelId, HotelName, Description, Tags, Rating",
  "searchMode": "all",
  "queryType": "simple",
  "count": true,
  "filter": "search.ismatch('lux*', 'Description')"
}

출력은 다음과 같은 일치하는 항목들로 구성됩니다.

{
  "@odata.count": 4,
  "value": [
    {
      "@search.score": 1,
      "HotelId": "18",
      "HotelName": "Ocean Water Resort & Spa",
      "Description": "New Luxury Hotel for the vacation of a lifetime. Bay views from every room, location near the pier, rooftop pool, waterfront dining & more.",
      "Tags": [
        "view",
        "pool",
        "restaurant"
      ],
      "Rating": 4.2
    },
    {
      "@search.score": 1,
      "HotelId": "13",
      "HotelName": "Luxury Lion Resort",
      "Description": "Unmatched Luxury. Visit our downtown hotel to indulge in luxury accommodations. Moments from the stadium and transportation hubs, we feature the best in convenience and comfort.",
      "Tags": [
        "bar",
        "concierge",
        "restaurant"
      ],
      "Rating": 4.1
    },
    {
      "@search.score": 1,
      "HotelId": "16",
      "HotelName": "Double Sanctuary Resort",
      "Description": "5 star Luxury Hotel - Biggest Rooms in the city. #1 Hotel in the area listed by Traveler magazine. Free WiFi, Flexible check in/out, Fitness Center & espresso in room.",
      "Tags": [
        "view",
        "pool",
        "restaurant",
        "bar",
        "continental breakfast"
      ],
      "Rating": 4.2
    },
    {
      "@search.score": 1,
      "HotelId": "14",
      "HotelName": "Twin Vortex Hotel",
      "Description": "New experience in the making. Be the first to experience the luxury of the Twin Vortex. Reserve one of our newly-renovated guest rooms today.",
      "Tags": [
        "bar",
        "restaurant",
        "concierge"
      ],
      "Rating": 4.4
    }
  ]
}

다음 단계