Skip to content

Commit

Permalink
馃摎 add documentation about datasets and configs
Browse files Browse the repository at this point in the history
  • Loading branch information
tofran committed Mar 31, 2024
1 parent 617d3fa commit 68ec90b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
DEVELOPMENT_MODE=True
ENABLE_INDEX_MANAGEMENT=True
PREVENT_HTML_API_DIRECT_ACCESS=False

SQLITE_DATABASE_PATH=products.sqlite

ALGOLIA_APP_ID=
ALGOLIA_API_KEY=
ALGOLIA_INDEX_NAME=products
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Server Side Rendering (SSR) declarative web framework with zero custom JS:
## Description and demo

**[Live demo](https://full-text-search-demo.tofran.com/)**
(the server goes to sleep, give at least 30s for a cold start)

https://github.com/tofran/fastapi-htmx-full-text-search-demo/assets/5692603/43d642fd-52d5-4e5b-836a-6609d0c3d782

Expand All @@ -38,8 +39,9 @@ HTMX handles the rest, listens to DOM events and updates it when when necessary.
## Development

- Create a `.env` file based on the `.env.template`.
You will need an Algolia account, should be pretty simple to setup
(more info in their [Quick start guide](https://www.algolia.com/doc/guides/getting-started/quick-start/)).
You will need an Algolia account, more info in their
[Quick start guide](https://www.algolia.com/doc/guides/getting-started/quick-start/).
More information about the env vars can be found in `./text_search_app/config.py`

- Setup a local environment with `make setup-venv`,
activate it with `source ./venv/bin/activate`
Expand All @@ -55,3 +57,18 @@ For deployment one would use the `./Dockerfile` and set the required environment

For running locally a production like build, install the dependencies with `make install`
and run the application with `make start`. That's it.

## Uploading a dataset

To keep this repository clean, no sample data is provided. You can upload your own data via the
`/index/upload-csv`.
Information about the supported CSV file columns available in the Swagger UI (`/docs`).

Recommended datasets (adapt column names when needed):

- [Zara Products on Kaggle](https://www.kaggle.com/datasets/maparla/zara-products)
- [Amazon Products Dataset 2023 on Kaggle](https://www.kaggle.com/datasets/asaniczka/amazon-products-dataset-2023-1-4m-products/)

## License

MIT
2 changes: 1 addition & 1 deletion text_search_app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ def get_bool_env(name: str, default: bool) -> bool:
ALGOLIA_API_KEY = os.environ["ALGOLIA_API_KEY"]
ALGOLIA_INDEX_NAME = os.environ["ALGOLIA_INDEX_NAME"]

SQLITE_DATABASE_PATH = "products.sqlite"
SQLITE_DATABASE_PATH = getenv("SQLITE_DATABASE_PATH", "products.sqlite")

RESULTS_PAGE_SIZE = 8

0 comments on commit 68ec90b

Please sign in to comment.