There are many situations where you would want to have an influence on how the score of the documents is calculated. For example, you would perhaps like to boost the documents on the basis of the purchases of it. Like in an e-commerce boost store, you would like to show relevant results, but you would like to influence them by adding yet another factor to their score. Is it possible? Yes, and this recipe will show you how to do it.
Let's start with the following index structure (just add the following to the field section in your
schema.xml
file):<field name="id" type="string" indexed="true" stored="true" required="true" /> <field name="title" type="text" indexed="true" stored="true" /> <field name="sold" type="int" indexed="true" stored="true" />
The example data looks like the following code:
<add> <doc> <field name="id">1</field> <field name="title">Solrcook book revised</field> ...