{"_id":"57b61405c6bf290e0036ac23","__v":0,"githubsync":"","parentDoc":null,"project":"5668fab608f90021008e882f","version":{"_id":"5668fab608f90021008e8832","__v":19,"project":"5668fab608f90021008e882f","createdAt":"2015-12-10T04:08:22.769Z","releaseDate":"2015-12-10T04:08:22.769Z","categories":["5668fab708f90021008e8833","569740f124490c3700170a64","569742b58560a60d00e2c25d","569742bd0b09a41900b2446c","569742cd69393517000c82b3","569742f459a6692d003fad8f","569743020b09a41900b2446d","5697430b69393517000c82b5","56a17776470ae00d00c30642","56a2c48a831e2a0d0069b1ad","56b535757bccae0d00e9a1cd","56e1ff6aa49fdc0e005746b5","57e1c88115bf6522002a5e4e","57fa65275ba65a17008b988f","57fbeea34002550e004c032e","58474584889b6c2d00fb86e9","58475dcc64157f0f002f1907","587e7b5158666c2700965d4e","58a349fc30852819007ba083"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.18.0","version":"1.18"},"category":{"_id":"57fa65275ba65a17008b988f","__v":0,"version":"5668fab608f90021008e8832","project":"5668fab608f90021008e882f","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-10-09T15:41:27.321Z","from_sync":false,"order":7,"slug":"model-query-javascript","title":"Model query (Javascript)"},"user":"5668fa9755e4b32100935d41","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-08-18T20:01:09.361Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Categorizing items\",\n  \"body\": \"We don't recommend creating too many channel/category for your inventory. For instance, if you have 10000 items and have 5000 categories with at least 1 item on each category, then asking for a recommendation only for a specific category may not return any results if the specific category has no user activity.\"\n}\n[/block]\nSometimes you may want to restrict recommendation to a specific category that you've defined. For example, you might want to recommend `news` article for specific section and `videos` on some other pages. You can define a field called `channel` to specify the broad category of the item. \n\nElaborating from the mentioned example, sample query below will return items that are marked with specified `channel` value:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$p('register', {\\n\\tmax: 50,  // Large number requested so you can see our full range of items\\n\\twidget: 'default-widget', // name of widget\\n\\topts: {channel: \\\"videos\\\"}, // Return items that have value \\\"videos\\\" on channel.\\n\\tcallback: function (resp) {\\n\\t\\tconsole.log(JSON.stringify(resp, null, 2));\\n\\t}\\n});\\n\\n$p('fetch’);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nTo setup the `channel` scraping for each web page, please refer to [Inventory section](https://liftigniter.readme.io/docs/defining-you-inventory#liftigniter-json-object) of documentation.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Category recommendations require activation by LiftIgniter\",\n  \"body\": \"In order to make sure that the rules are working as intended, the LiftIgniter team requires you to contact us at support:::at:::liftigniter.com to activate channel-based filters. We will activate the rule and run quality checks, and may have other suggestions on how to achieve your goals.\"\n}\n[/block]","excerpt":"","slug":"recommend-specific-category-of-items","type":"basic","title":"Recommend from category"}

Recommend from category


[block:callout] { "type": "warning", "title": "Categorizing items", "body": "We don't recommend creating too many channel/category for your inventory. For instance, if you have 10000 items and have 5000 categories with at least 1 item on each category, then asking for a recommendation only for a specific category may not return any results if the specific category has no user activity." } [/block] Sometimes you may want to restrict recommendation to a specific category that you've defined. For example, you might want to recommend `news` article for specific section and `videos` on some other pages. You can define a field called `channel` to specify the broad category of the item. Elaborating from the mentioned example, sample query below will return items that are marked with specified `channel` value: [block:code] { "codes": [ { "code": "$p('register', {\n\tmax: 50, // Large number requested so you can see our full range of items\n\twidget: 'default-widget', // name of widget\n\topts: {channel: \"videos\"}, // Return items that have value \"videos\" on channel.\n\tcallback: function (resp) {\n\t\tconsole.log(JSON.stringify(resp, null, 2));\n\t}\n});\n\n$p('fetch’);", "language": "javascript" } ] } [/block] To setup the `channel` scraping for each web page, please refer to [Inventory section](https://liftigniter.readme.io/docs/defining-you-inventory#liftigniter-json-object) of documentation. [block:callout] { "type": "warning", "title": "Category recommendations require activation by LiftIgniter", "body": "In order to make sure that the rules are working as intended, the LiftIgniter team requires you to contact us at support@liftigniter.com to activate channel-based filters. We will activate the rule and run quality checks, and may have other suggestions on how to achieve your goals." } [/block]