Relevancy boosting

Let's see how we can boost some documents in Solr. Relevancy boosting can be very helpful in e-commerce websites to promote some products. In our musicStore core, we've specified a Boolean field called sale, which will tell whether the song is available for sale or not. While showing the results to the user, we can boost the documents that have sale=true in them.

We'll need to index the sampleMusicStoreData2.csvfile to Solr, as it contains more data about songs, which is needed for this example. We can use the following command to index the file:

curl 'http://localhost:8983/solr/musicStore/update?commit=true' --data-binary @sampleMusicStoreData2.csv -H 'Content-type:application/csv'

We can now use the following URL to see the indexed ...

Get Apache Solr for Indexing Data now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.