問合せごとの言語コードの指定

レコード検索と値検索の問合せでは、それらの問合せに使用される言語を指定できます。

SearchFilterタイプには、どの言語レコード(フルテキスト)の問合せがあるかをDgraphに伝えるために使用するLanguage属性があります。同様に、ValueSearchConfigタイプには、値検索の問合せ用のLanguage属性があります。この問合せごとの言語コードにより、Dgraphは特定の問合せに適した辞書を選択できます。

問合せごとの言語IDを指定しない場合、Dgraphはunknown言語識別子を使用します。

次のコード・スニペットは、問合せのテキスト部分(検索語など)の言語に、(言語コードenを使用して)英語を設定する方法を示しています。

レコード検索の言語設定の例

<Request xmlns="http://www.endeca.com/MDEX/conversation/2/0">
  <State />
  <Operator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:type="SearchOperator" Within="false">
    <SearchFilter Mode="AllPartial" RelevanceRankingStrategy="numfields"
     Key="Description" EnableSnippeting="false" Language="en">
       crank
    </SearchFilter>
  </Operator>
  <ContentElementConfig xsi:type="RecordListConfig"
     HandlerFunction="RecordListHandler"
     HandlerNamespace="http://www.endeca.com/MDEX/conversation/2/0"
     Id="RecordList" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <Column>Description</Column>
     <RecordsPerPage>5</RecordsPerPage>
  </ContentElementConfig>
</Request>

値検索の言語設定の例

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Request xmlns="http://www.endeca.com/MDEX/conversation/2/0">
      <State />
      <Operator xsi:type="RecordKindOperator" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <RecordKind>data</RecordKind>
      </Operator>
      <ContentElementConfig xsi:type="ValueSearchConfig" 
         Id="ValueSearch" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         HandlerNamespace="http://www.endeca.com/MDEX/conversation/2/0"
         HandlerFunction="ValueSearchHandler"
         MaxPerProperty="5"
         RelevanceRankingStrategy="static (nbins,descending)"
         Mode="Any"
         Language="en">
         <SearchTerm>envoy</SearchTerm>
         <RestrictToProperties>
            <Property>PROD_NAME</Property>
         </RestrictToProperties>
      </ContentElementConfig>
    </Request>
  </soap:Body>
</soap:Envelope>