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
- Python 3.10+
- A TiDB Cloud Starter cluster: Create a free cluster here: tidbcloud.com
↗️
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.txtStep 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=fulltext_search_example
EOFStep 4: Run the Streamlit app
streamlit run app.pyStep 5: open the browser and visit http://localhost:8501
