Skip to content

Guide

Multilingual menu search

Menus on a delivery platform are written in whatever language the restaurant prefers. A Korean place lists "비빔밥", a Lebanese grill writes "دجاج شاورما", and the dumpling shop next door uses "餃子". Your customers, meanwhile, type in English, in romanized Arabic, or in their own script. Keyword search only finds an item when the query and the menu share the same characters, so most of those searches come back empty.

The /search endpoint matches by meaning across 100+ languages and writing systems. A customer types "shawarma dajaj" and gets the Arabic-script shawarma as the top result. You don't translate queries, maintain synonym tables, or build an index per language.

Endpoint
POST /search
Plans
Every plan

What it handles

  • Cross-script queries. A Latin-script query finds items written in Japanese, Korean, Arabic, Chinese, Thai, Cyrillic, and other scripts, and the other way round.
  • Transliterated and romanized names. "Shawarma dajaj" (romanized Arabic for chicken shawarma) matches the Arabic-script listing.
  • Mixed-language menus. One corpus can hold items in several languages. No language parameter, no per-language setup.
  • Spelling drift. Common misspellings and spelling variants are normalized before search, so "Tonkotsu Ramyen" still finds your ramen.
  • Intent queries. "Something spicy" or "warming winter meal" work on mixed-language menus too, since ranking follows what a dish is.

Original scripts are kept exactly as submitted. Normalization rules only touch Latin-script text, and the results you get back use your original item text, so you can render them as-is. See Built-in preprocessing for details.

Search a multilingual menu

Request
curl
curl -X POST https://dish-embed.latimal.com/search \
  -H "X-API-Key: $LATIMAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "shawarma dajaj",
    "corpus": ["Margherita Pizza", "Pad Thai", "Falafel Plate", "Pho Ga", "餃子", "دجاج شاورما", "비빔밥", "Tonkotsu Ramen", "Spicy Chicken Tacos", "Tiramisu"],
    "top_k": 3
  }'

In Python, with requests:

Python
import os
import requests

API = "https://dish-embed.latimal.com"
HEADERS = {"X-API-Key": os.environ["LATIMAL_API_KEY"]}


def search(query, corpus, top_k=10):
    response = requests.post(
        f"{API}/search",
        headers=HEADERS,
        json={"query": query, "corpus": corpus, "top_k": top_k},
        timeout=30,
    )
    response.raise_for_status()
    return response.json()


menu = [
    "Margherita Pizza", "Pad Thai", "Falafel Plate", "Pho Ga",
    "餃子", "دجاج شاورما", "비빔밥",
    "Tonkotsu Ramen", "Spicy Chicken Tacos", "Tiramisu",
]

result = search("shawarma dajaj", corpus=menu, top_k=3)

for r in result["results"]:
    print(f"{r['text']}  score={r['score']:.3f}")

The Arabic-script "دجاج شاورما" ranks first, even though the query and the item share no characters. Example response:

Response
Example
{
  "results": [
    {"text": "دجاج شاورما", "score": 0.86, "is_fallback": false}
  ],
  "query_preprocessed": "shawarma dajaj"
}

You'll often get fewer results than top_k. Search filters out weak tail matches so the list stays relevant.

Other queries worth trying against the same menu: "dumplings", "bibimbap", "mixed rice bowl", "noodle soup", "something spicy".

Mapping results back to your items

Results return each item's text exactly as you sent it. Keep a lookup from text to your item record so you can attach IDs, prices, and images:

Python
items = [
    {"id": "itm_101", "name": "دجاج شاورما", "price": "9.50", "currency": "EUR"},
    {"id": "itm_102", "name": "비빔밥",       "price": "12.00", "currency": "EUR"},
    {"id": "itm_103", "name": "餃子",         "price": "7.00", "currency": "EUR"},
    {"id": "itm_104", "name": "Pho Ga",       "price": "13.50", "currency": "EUR"},
]

by_name = {item["name"]: item for item in items}
result = search("bibimbap", corpus=list(by_name), top_k=5)

hits = [by_name[r["text"]] for r in result["results"]]

If two items share the exact same name (two sizes, say), make the corpus string unique, for example by including the size, or keep a list of records per name.

Ranking and display

  • Results come back sorted, most relevant first. Keep that order when you render them.
  • is_fallback: true means no high-confidence match was found and the result came from category-aware fallback. You can show these under a "You might also like" heading.
  • query_preprocessed shows the query after noise removal. Log it next to the raw query when you're tuning search.
  • Show item names in their original script. If your app has a secondary display language, render your own translated label beside it; the search itself doesn't need one.

Larger menus and repeated searches

A single request searches up to 512 corpus items. For a restaurant menu that's plenty. When the same menu is searched over and over, pre-compute the corpus embeddings once and pass them as corpus_embeddings, so the server skips encoding the corpus on every query. The Search integration guide walks through that pattern, including re-embedding only changed items. For catalogs bigger than one request, store vectors in your own search engine with one of the integration recipes.

Tips

  • Send queries as the customer typed them. Translating or transliterating before the call adds latency and can drop meaning the API would have used.
  • Keep diacritics and original scripts in your corpus. Send names the way the restaurant writes them.
  • Put every language for a restaurant in one corpus. Splitting by language means a query in one script never sees items in another.
  • /search is available on every plan, Starter included.

Try it in the playground

The search playground loads a global menu with Japanese, Arabic, and Korean script items. Run the "shawarma dajaj" example to see a romanized query land on the Arabic-script dish, or type your own queries. No key needed.