Collaborative items-for-item recommendations
If you have enabled signals and recommendations for a collection, then the defaultCOLLECTION_NAME_item_recommendations job is already created and configured to produce items-for-item recommendations (as well as items-for-user recommendations):

Learn more
Fetch Items-for-Item Recommendations (Collaborative/ALS Method)
Fetch Items-for-Item Recommendations (Collaborative/ALS Method)
The BPR method is recommended and the ALS method is deprecated.
_items_for_item_recommendations query pipeline is created by default and configured to fetch items-for-item recommendations using the output from the ALS Recommender job. It is similar to the default query pipeline that fetches content from your main collection, but it has an additional Recommend Items for Item stage:
- Use only the Recommend Items for Item stage
This method returns only the document IDs of the recommended items. Your search application must perform additional queries to retrieve the desired fields for those items, such as their names, images, categories, and so on. - Query Solr directly
This method returns complete documents about the recommended items from the_items_for_item_recommendationscollection. The fields that are included in these recommender documents are configured in the recommender job’sitemMetadataJoinFieldItem Metadata Join Field anditemMetadataFieldsItem Metadata Fields fields.
Fetching recommendations from App Studio
App Studio can only access user-created collections; it cannot access system collections such as the default collections that Fusion creates for recommendations. If you are using App Studio to create your front-end search application, you must:- Create a new collection for item-for-item recommendations
- Configure the recommender job to send output to the user-created collection instead of the system collection
- Direct your queries to the user-created collection
Fetching with the Recommend Items for Item stage
With this method, we use only one query pipeline stage: the Recommend Items for Item query stage. This stage works with the output from the ALS Recommender job.This method returns only the document IDs of the recommended items. Your search application must perform additional queries to retrieve the desired fields for those items, such as their names, images, categories, and so on.How to fetch recommendations using the Recommend Items for Item stage- From your
_items_for_item_recommendationscollection, navigate to Querying > Query Workbench.
- Click Load… and open the
_items_for_item_recommendationsquery pipeline, if it is not open already. - Disable all of the pipeline stages except Recommend Items for Item.
- Verify that the following fields are correctly configured in the Recommend Items for Item query stage:
numRecommendations/Number of Recommendations
This is the number of recommendations to return. It should be less than or equal to the value of thenumSims/Number of Item Similarities to Compute parameter in the model tuning parameters of theCOLLECTION_NAME_item_recommendationsjob configuration.modelID/Model ID
This must match themodelId/Recommender Model ID value in the recommender job’s model settings.collection/Recommendation Collection
This should be the collection specified in theoutputItemSimCollection/Item-to-item Similarity Collection parameter of the recommender job’s Input/output settings.resultsLocation/Results Location
Select the As Response value for this field.- There are several fields that specify the names of fields that should be present in the documents in the
_items_for_item_recommendationscollection. Verify that these values match the field names in that collection. - To use live signals in addition to historical signals, enable Estimate Recent Results.
Be sure to click Apply after changing any of the stage configuration parameters.
At this point, the results panel should display “No Search Results”. This is normal; we will see results at a later step.
- Click Save.
- Test the pipeline configuration:
- Select an item from your main collection to use for testing.
- Navigate to your main collection and open the Query Workbench.
- Search for an item and copy the value of its
idfield. - Return to the
_items_for_item_recommendationscollection and the Query Workbench.
- Click Parameters.
- Click Edit Parameters.
The Parameters and Values window appears. - Click the Add
icon. - Enter the parameter name
item_idand the value that you copied from theidfield of the item in your main collection.\
- Click Close to close the Parameters and Values window.
- In the lower right, select View As: JSON:
Notice that the search results contain only a document ID and a weight, as you can see when you expand the
itemsfield and any of itsObjectfields:
- Select an item from your main collection to use for testing.
- Get the query URI that your search application can use to retrieve recommendations from your modified pipeline:
- Click URI.
The Query Workbench displays a Working URI and a Published URI.\
- Click the Published URI to copy it to your clipboard.
This is the URI and parameters that your search application should use to query for additional recommendations.
- Click URI.
-
Each time you query for recommendations, replace the
item_idparameter value with the ID of the item for which you want recommendations. - Replace the Fusion hostname as needed, depending on your production environment.
-
As shown above, Fusion returns an array of document IDs and weights. Your search application must then query the main collection to retrieve the details about each of the recommended documents.
That is, for each
docIdvalue returned from the recommendations collection, query for the correspondingidvalue in the main collection, and order the set of results according to theweightvalue from the recommendations collection.
Querying Solr directly
With this method, we use only the Solr Query pipeline stage.This method returns only the document IDs of the recommended items. Your search application must perform additional queries to retrieve the desired fields for those items, such as their names, images, categories, and so on.How to fetch recommendations using the Solr Query stage- From your
_items_for_item_recommendationscollection, navigate to Querying > Query Workbench. - Click Load.
- Select the
_items_for_item_recommendationsquery pipeline. - Disable all stages in the pipeline except the Solr Query stage.
- Click Save.
- Test the pipeline configuration:
- Select an item from your main collection to use for testing.
- Navigate to your main collection and open the Query Workbench.
- Search for an item and copy the value of its
idfield. - Return to the
_items_for_item_recommendationscollection and the Query Workbench.
- In the search field, enter the parameter name
itemIdand the value that you copied from theidfield of the item in your main collection.
For example, enteritemId:10463303(substituting the value from your main collection) and click the Search button.
The number of results should be the same as thenumRecs/Number of User Recommendations to Compute value in the_item_recommendationsjob (the default is 10).
- In any of the search results, click show fields.
Notice these important fields:itemIdis the original item to which the recommendation pertains.otherItemIdis the recommended item.simis the similarity score, or the estimated likelihood that the recommended item is related to the original item.
- Select an item from your main collection to use for testing.
- Get the query URI that your search application can use to retrieve recommendations from your modified pipeline:
- Click URI.
The Query Workbench displays a Working URI and a Published URI.\
- Click the Published URI to copy it to your clipboard.
This is the URI and parameters that your search application should use to query for additional recommendations.
- Click URI.
-
Each time you query for recommendations, replace the
itemIdparameter value with the ID of the item for which you want recommendations. - Replace the Fusion hostname as needed, depending on your production environment.
-
As shown above, Fusion returns a set of results that each include an
otherItemIdand asimscore. Your search application must then query the main collection to retrieve the details about each of the recommended documents. That is, for eachotherItemIdvalue returned from the recommendations collection, query for the correspondingidvalue in the main collection, and order the set of results according to thesimvalue from the recommendations collection.