Line 48: |
Line 48: |
| } | | } |
| </pre> | | </pre> |
| + | |
| + | == Product Attributes == |
| + | |
| + | For each product, the server returns a match value for each attribute in a standardized format. |
| + | |
| + | See [[Product Attributes]]. |
| + | |
| + | == Scoring == |
| + | |
| + | On the client side, a library computes a score for each product returned by a search: |
| + | |
| + | === Input and output values === |
| + | |
| + | * Input values for scoring |
| + | ** Locally saved user preferences |
| + | ** Product attributes returned by the server API |
| + | * Output value |
| + | ** Score |
| + | |
| + | === Algorithm === |
| + | |
| + | * for each requirement in user preferences |
| + | ** if requirement is mandatory, score = score + match * 4 |
| + | *** and exclude product is match is less than 20% |
| + | *** or mark product as unknown if the attribute value is unknown (e.g. the server is missing some data to compute the match for the attribute) |
| + | ** if requirement is very important, score = score + match * 2 |
| + | ** if requirement is important, score = score + match |
| + | |
| + | === Implementation === |
| + | |
| + | * Flutter |
| + | * Javascript |
| + | ** UI to locally save user preferences - https://github.com/openfoodfacts/openfoodfacts-server/issues/4119 |
| + | ** Javascript library to score a product based on locally saved user preferences + product attributes from the API - https://github.com/openfoodfacts/openfoodfacts-server/issues/4120** |
| | | |
| [[Category:Project:Personalized_Search]] | | [[Category:Project:Personalized_Search]] |
| [[Category:ProductOpener]] | | [[Category:ProductOpener]] |