Specifying a per-query language code

Record search and value search queries can specify the language used for those queries.

The TextSearchFilter type has a Language attribute that you use to tell the Dgraph what language record (full-text) queries are in. Likewise, the ValueSearchConfig type has a similar Language attribute for value search queries. This per-query language code enables the Dgraph to select the appropriate dictionary for a given query.

If no per-query language ID is specified, the Dgraph uses the unknown language identifier.

The following code snippets show how to set English (using its language code of "en") as the language of any text portion of the query (such as search terms).

Example of language setting for record search

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
   <soapenv:Header/>
   <soapenv:Body>
      <Request xmlns="http://www.endeca.com/MDEX/conversation/3/0">
         <State>
            <Name>MyRecSearch</Name>
            <TextSearchFilter Key="Description" Mode="AllPartial" EnableSnippeting="false" 
                Language="en">mountain</TextSearchFilter>
         </State>
         <RecordListConfig Id="RecordList" MaxPages="20">
            <StateName>MyRecSearch</StateName>
            <Column>Description</Column>
            <RecordsPerPage>5</RecordsPerPage>
         </RecordListConfig>
      </Request>
   </soapenv:Body>
</soapenv:Envelope>

Example of language setting for value search

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Request xmlns="http://www.endeca.com/MDEX/conversation/3/0">
         <State>
            <Name>MyProductSearch</Name>
            <RecordKind>data</RecordKind>
         </State>
         <ValueSearchConfig Id="ValueSearch" MaxPerProperty="5" 
              RelevanceRankingStrategy="static (nbins,descending)" Mode="Any" Language="en">
            <StateName>MyProductSearch</StateName>
            <SearchTerm>aluminum</SearchTerm>
         </ValueSearchConfig>
    </Request>
  </soap:Body>
</soap:Envelope>