Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@algolia/recommend
Advanced tools
The perfect starting point to integrate Algolia Recommend within your JavaScript project.
@algolia/recommend is a JavaScript library that provides tools to integrate Algolia's recommendation engine into your application. It allows you to easily implement personalized recommendations, related products, and other recommendation-based features using Algolia's powerful search and recommendation APIs.
Personalized Recommendations
This feature allows you to fetch personalized recommendations for a specific user. By providing the user token and the index name, you can retrieve a list of recommended items tailored to the user's preferences.
const { createRecommendClient } = require('@algolia/recommend');
const recommendClient = createRecommendClient({
appId: 'YourApplicationID',
apiKey: 'YourAdminAPIKey'
});
recommendClient.getPersonalizedRecommendations({
indexName: 'products',
userToken: 'user-123',
maxRecommendations: 5
}).then(({ results }) => {
console.log(results);
});
Related Products
This feature allows you to fetch products related to a specific item. By providing the object ID of the product and the index name, you can retrieve a list of items that are similar or related to the specified product.
const { createRecommendClient } = require('@algolia/recommend');
const recommendClient = createRecommendClient({
appId: 'YourApplicationID',
apiKey: 'YourAdminAPIKey'
});
recommendClient.getRelatedProducts({
indexName: 'products',
objectID: 'product-123',
maxRecommendations: 5
}).then(({ results }) => {
console.log(results);
});
Frequently Bought Together
This feature allows you to fetch items that are frequently bought together with a specific product. By providing the object ID of the product and the index name, you can retrieve a list of items that are commonly purchased along with the specified product.
const { createRecommendClient } = require('@algolia/recommend');
const recommendClient = createRecommendClient({
appId: 'YourApplicationID',
apiKey: 'YourAdminAPIKey'
});
recommendClient.getFrequentlyBoughtTogether({
indexName: 'products',
objectID: 'product-123',
maxRecommendations: 5
}).then(({ results }) => {
console.log(results);
});
Recombee API Client is a library for integrating Recombee's recommendation engine into your application. It offers similar functionalities such as personalized recommendations, related items, and frequently bought together features. Compared to @algolia/recommend, Recombee provides a more extensive set of recommendation algorithms and customization options.
PredictionIO is an open-source machine learning server for building and deploying predictive engines. It allows you to create custom recommendation systems, including personalized recommendations and related items. While it offers more flexibility and customization compared to @algolia/recommend, it requires more setup and maintenance.
Documentation • UI library • Community Forum • Stack Overflow • Report a bug • Support
First, install Algolia Recommend API Client via the npm package manager:
npm install @algolia/recommend
Then, let's retrieve recommendations:
const algoliarecommend = require('@algolia/recommend');
const client = algoliarecommend('YourApplicationID', 'YourAdminAPIKey');
client
.getFrequentlyBoughtTogether([
{
indexName: 'your_index_name',
objectID: 'your_object_id',
},
])
.then(({ results }) => {
console.log(results);
})
.catch(err => {
console.log(err);
});
client
.getRelatedProducts([
{
indexName: 'your_index_name',
objectID: 'your_object_id',
},
])
.then(({ results }) => {
console.log(results);
})
.catch(err => {
console.log(err);
});
For full documentation, visit the online documentation.
Algolia Recommend API Client is an open-sourced software licensed under the MIT license.
FAQs
JavaScript client for recommend
The npm package @algolia/recommend receives a total of 371,141 weekly downloads. As such, @algolia/recommend popularity was classified as popular.
We found that @algolia/recommend demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.