Skip to content

Fulltext Search Example

This example demonstrates how to build a E-commerce product search application using TiDB's full-text search feature with multilingual support. Users can search for products by keywords in their preferred language.

E-commerce product search with full-text search

E-commerce product search with full-text search

Prerequisites

How to run

Step 1: Clone the repository to local

git clone https://github.com/pingcap/pytidb.git
cd pytidb/examples/fulltext_search/;

Step 2: Install the required packages and setup environment

python -m venv .venv
source .venv/bin/activate
pip install -r reqs.txt

Step 3: Set up environment to connect to database

Go to the TiDB Cloud console, create a new cluster if you don't have one, and then get the connection parameters on the connection dialog.

cat > .env <<EOF
TIDB_HOST={gateway-region}.prod.aws.tidbcloud.com
TIDB_PORT=4000
TIDB_USERNAME={prefix}.root
TIDB_PASSWORD={password}
TIDB_DATABASE=pytidb_fulltext_demo
EOF

Step 4: Run the Streamlit app

streamlit run app.py

Step 5: open the browser and visit http://localhost:8501


  • Source Code: View on GitHub
  • Category: Search

  • Description: Perform traditional text search using MySQL fulltext search capabilities.

🏠 Back to Demo Gallery