FastAPI service for searching Life365 products.
Base URL: http://localhost:8000
/search response includes:
total,page,page_size,resultsgroups.brand: a map{brand_name: matched_count}computed over all matched documents for the query+filters (not only the current page)groups.category_level_1|2|3: maps{category_id: matched_count}groups.type1|type2: maps{type_value: matched_count}
| Param | Type | Default | Constraints |
|---|---|---|---|
q |
string | null |
null |
Full-text query |
category_level_1 |
int | null |
null |
|
category_level_2 |
int | null |
null |
|
category_level_3 |
int | null |
null |
|
brand |
string | null |
null |
|
available |
bool |
true |
|
visible |
bool |
true |
|
page |
int |
1 |
>= 1 |
page_size |
int |
20 |
>= 1, <= 100 |
lang |
enum |
it |
it, en, cn |
sort |
enum |
relevance |
relevance, newest, brand |
relevance: sorts by OpenSearch_score(best text match first). Scoring usestitle(higher boost),keywords,description, and category title in the selected language.newest: sorts bycreated_atdescending (most recent first).brand: sorts bybrandascending (A to Z) using exact keyword values.
Notes:
- Filters (
category_level_*,brand,available,visible) limit which products are returned, but do not change text relevance scoring. - If
qis omitted, the query ismatch_all; withsort=relevance, ordering is not meaningful by relevance.
curl -s http://localhost:8000/healthcurl -sG http://localhost:8000/search --data-urlencode "q=pellicola"Example response excerpt:
{
"total": 110,
"page": 1,
"page_size": 20,
"results": [
{
"product_id": 16453,
"title": "Toner compa 2310,2350,2370,2375,2510,2530,2550,2730,2750-3K",
"brand": "Pro-Brother",
"is_available": true
}
],
"groups": {
"brand": {
"Pro-Brother": 6,
"Pro-Canon": 4
},
"category_level_1": {
"1": 39,
"14": 2
},
"category_level_2": {
"188": 20
},
"category_level_3": {
"1134": 12
},
"type1": {
"200W": 1,
"250W": 2,
"Blue-White": 1
},
"type2": {
"200W": 1,
"250W": 2,
"Blue-White": 1
}
}
}curl -sG http://localhost:8000/search --data-urlencode "q=DETPUPD03228"curl -sG http://localhost:8000/search --data-urlencode "q=6938595306273"curl -sG http://localhost:8000/search \
--data-urlencode "q=iphone" \
--data-urlencode "category_level_1=1" \
--data-urlencode "category_level_2=2" \
--data-urlencode "brand=Devia"curl -sG http://localhost:8000/search \
--data-urlencode "q=cover" \
--data-urlencode "lang=en" \
--data-urlencode "page=2" \
--data-urlencode "page_size=10" \
--data-urlencode "sort=newest"curl -sX POST http://localhost:8000/admin/reindexWhen running with docker-compose, the scheduler service also triggers
app.infrastructure.celery.tasks.reindex_all_task automatically every 6 hours
using the schedule defined in worker/reindex.cron.