Changes

Jump to navigation Jump to search
Line 14: Line 14:     
== User preferences ==
 
== User preferences ==
 +
 +
The user preferences are stored locally on the client (mobile app or browser).
    
=== User preferences format ===
 
=== User preferences format ===
   −
Hash of attribute ids with string values.
+
To make it easier to develop libraries to show / edit / store preferences, and to use them to rank products, we define a standard format to save user preferences.
 +
 
 +
The preferences are saved in name / value pairs (hash table / associative array) of attribute ids mapping to string values.
    
The list of attribute ids will be sent by the server, along with localized names, descriptions, warnings etc.
 
The list of attribute ids will be sent by the server, along with localized names, descriptions, warnings etc.
Line 23: Line 27:  
String values:
 
String values:
   −
* unset
+
* "unset" : the user has not set a preference for the attribute (in ranking, treated like "not_important")
* not_important
+
* "not_important"
* important
+
* "important"
* very_important
+
* "very_important"
* mandatory
+
* "mandatory"
 +
 
 +
The user preferences structure may not contain all possible attributes (e.g. if the server adds new attributes). In that case unexisting values are considered "unset".
 +
 
 +
Notes:
 +
* String values are used instead of 0, 1, 2, 3, 4 etc. so that the JSON is clearer to understand for humans, and so that we have the flexibility to add other values later (e.g. "somewhat_important")
 +
 
 +
==== Example ====
   −
String values are used instead of 0, 1, 2, 3, 4 etc. so that the JSON is clearer to understand for humans, and so that we have the flexibility to add other values later (e.g. "somewhat_important")
+
<pre>
 +
{
 +
  "nutriscore": "very_important",
 +
  "nova": "not_important",
 +
  "labels_organic": "very_important",
 +
  "labels_fair_trade": "important"
 +
}
 +
</pre>
    
[[Category:Project:Personalized_Search]]
 
[[Category:Project:Personalized_Search]]
 
[[Category:ProductOpener]]
 
[[Category:ProductOpener]]

Navigation menu