The Content-Based Recommender job is deprecated in Lucidworks Search 5.19.0 and is expected to be removed in 6.0.0.
For more information, see Deprecations and Removals.
First, item content is vectorized; different vectorization methods are available. Then, similar items are selected based on cosine similarity (“nearest neighbor”) between their vectors.
At a minimum, you must specify these:
- An ID for this job
- The name of the training collection, that is, the collection with your content
- An output collection; create a separate collection for this
- The name of the ID field for documents in the training collection, such as
item_id_s - The names of one or more content fields in the training collection
Tuning tips
- Configure Metadata fields for item-item evaluation to use those fields during evaluation to determine whether pairs belong to the same category.
- Perform approximate nearest neighbor search is enabled by default to significantly reduce the job’s running time, with a small decrease in accuracy. If your training dataset is very small, then you can disable this option.
- If your content contains a lot of domain-specific jargon, enable Use Word2Vec for vectorization.
- If your documents are too short or too long, enable Use TF-IDF for vectorization.
- If the job runs out of memory during encoding, reduce Batch size to compute encodings. The default is 1024. Halve the value until the job completes, for example 512, then 256, then 128. Smaller batches don’t reduce recommendation quality.
Query pipeline setup
To create the query pipeline that consumes this job’s output, see Fetch Items-for-Item Recommendations (Content-Based Method).Fetch Items-for-Item Recommendations (Content-Based Method)
Fetch Items-for-Item Recommendations (Content-Based Method)
You can download and import a query pipeline that works out of the box to fetch the items-for-item recommendations generated by the default Content-Based Recommender job.There are two separate pipelines attached below which work in different ways to query and return recommendations.Query for recommendations onlyNo additional configuration is needed to use this pipeline with the default BPR job configuration.Boost recommended products from catalogSee also
- Download the
APPName_item_item_rec_pipelines_content.jsonfile. - Rename the file to replace
APPNamewith the name of your Lucidworks Search app, such asProductCatalog_item_item_rec_pipelines_content.json. - Open the JSON file, replace all instances of
APPNamewith the name of your Lucidworks Search app, such asProductCatalog, and save it. - Import the JSON file into your Lucidworks Search instance using the Query Pipelines REST API:
- In the Lucidworks Search UI, navigate to Query > Query Pipelines to verify that the new pipeline is available.
This pipeline should be used to query the collection where the recommendations are stored. It makes a query against the
itemId field and returns the recommended itemId values. To get the actual items, you need to make a second query to the respective catalog collection with the returned itemId values.-
Download the
APPName_content_boost.jsonfile - Rename the file to replace
APPNamewith the name of your Lucidworks Search app, such asProductCatalog_content_boost.json. - Open the JSON file, replace all instances of
APPNamewith the name of your Lucidworks Search app, such asProductCatalog. - Fill in the
collectionname field in the firstRecommend Items for Itemstage and save the file. - Import the JSON file into your Lucidworks Search instance using the Query Pipelines REST API:
- In the Lucidworks Search UI, navigate to Query > Query Pipelines to verify that the new pipeline is available.
This pipeline queries the recommendations collection and then makes a subsequent query to the actual catalog collection boosting the recommended items and returning the actual items from the catalog. This pipeline will therefore also return recommendations even if none were generated/available.
This pipeline expects a request parameter called
id=itemId to be appended to the request. An example query URL to this pipeline would look like https://EXAMPLE_COMPANY.b.lucidworks.cloud/api/query-pipelines/APPName_items_for_user_bpr_boost/collections/catalog/select?q=**:**&id=SomeItemId