Table of Contents
Similarity Index API
branch01.picalike.corpex-kunden.de:9095/index_query
loadbalancer: http://similarity-index.lb.int.picalike.corpex-kunden.de:80/
url (legacy oder upload): http://branch01.picalike.corpex-kunden.de:9095/index_query
host: branch01.picalike.corpex-kunden.de
port: 9095
service name: /index_query
method: POST with a JSON
reload an index
all workers: http://branch01.picalike.corpex-kunden.de:9095/index_reload
worker one by one:
* tower01: http://tower01.picalike.corpex-kunden.de:4238/reload
* dev01: http://dev01.picalike.corpex-kunden.de:4238/reload
method: POST with a JSON
* index_name = The name of the indexes to be reloaded
git
picalike@sg01.picalike.corpex-kunden.de/home/picalike/repositories/v5/picalike_v5.git
deployment
SSH auf die Server, picalike@dev01 und neuron_cloud@tower01
screen -r index
es gibt zwei screen tabs:
- frontend = uwsgi –ini uwsgi_config_index_frontend.ini
- backend = python3 feature_similarity_service_all_shops.py
parameters
- index_name = The name of the indexes used for the loopup. Default:“all_images”. For every shop_id, there is an Index with the same name. A list of names is also possible.
- k = Number of images used for the similarity search
- shop_id = The shop the root image is in
- prod_id = The product if of the root image
- or
- features = list of features
- or if branch01 is called
- myfile = an image coded as base64 string
- return_metadata = if this is set to any value, the full documents from the meta-data-db are returned for each product
- return_negativ = if this is set to any value, all products are additionally returned that did not match the filter or have no metadata but were close in the index
- meta_data_filter = A dict in mongo style. Filters results in the 'metadata' field. There might be less then k products left after filtering. Examples:
- 1 Shop:
{"shop_id":"witt_de_feed"}
- N shops:
{"shop_id":{"$in":["witt_de_feed", "peterhahn_de_crawler"]}}
- last changed timestamp:
{"timestamp" :{ "$gte": 1544199370.0, "$lt": 1544199371.0 } }
- Minimal-Preis kleiner 50.00€ oder Maximal-Preis größer 10.00€
{"$or":[ {"metadata.min_price" :{ "$lt": 5000 } }, {"metadata.max_price" :{ "$gte": 1000 } } ] }
- Von Witt und zwischen x und y verändert:
{"$and":[ {"shop_id":"witt_de_feed"}, {"timestamp" :{ "$gte": 1544199370.0, "$lt": 1544199371.0 } } ] }
out
'root_images' → the reference image
'close_images_filtered_in' → the closest images, that match the filter
'hostname_worker' → the machine that did the job
'last_index_update' → last time the index in the worker was updated last_index_update
'errors' → list of happend errors
{ "_time_1_overall_ms": 7.35, "_time_2_get_args_ms": 0.15, "_time_3_get_root_ms": 2.14, "_time_4_feature_request_ms": 1.1, "_time_5_get_prod_ids_ms": 0.98, "_time_6_get_meta_data_ms": 2.98, "_time_7_sort_meta_data_ms": 0.02, "close_images_filtered_in": [ { "distance": 0.0, "int_id": 5, "product_data": [ { "matches_db_filter": true, "picalike_id": "9690328#asos_de_crawler", "prod_id": "9690328", "shop_id": "asos_de_crawler" } ], "url": "https://images.asos-media.com/products/asos-design-marineblaue-touchscreen-handschuhe/9690328-1-navy" }, { "distance": 1.0188307896896731e-05, "int_id": 717894, "product_data": [ { "matches_db_filter": true, "picalike_id": "9707579#asos_de_crawler", "prod_id": "9707579", "shop_id": "asos_de_crawler" } ], "url": "https://images.asos-media.com/products/asos-design-touch-screen-handschuhe-aus-wieder-aufbereitetem-polyester/9707579-1-navy" } ], "product_data_flat": [ { "distance": 0.0, "matches_db_filter": true, "picalike_id": "9690328#asos_de_crawler", "prod_id": "9690328", "shop_id": "asos_de_crawler" }, { "distance": 1.0188307896896731e-05, "matches_db_filter": true, "picalike_id": "9707579#asos_de_crawler", "prod_id": "9707579", "shop_id": "asos_de_crawler" } ], "root_images": [ { "picalike_id": [ "9690328#asos_de_crawler" ], "prod_id": [ "9690328" ], "shop_id": [ "asos_de_crawler" ], "url": "https://images.asos-media.com/products/asos-design-marineblaue-touchscreen-handschuhe/9690328-1-navy" } ] }