Please refer to the Solr Reference Guide's section on [Learning To Rank](https://lucene.apache.org/solr/guide/learning-to-rank.html) section for broader information on Learning to Rank (LTR) with Apache Solr.
3. the a score representing the relevance of that document (not necessarily between zero and one);
4. the source, i.e., if the training record was produced by using interaction data (`CLICK_LOGS`) or by human judgements (`HUMAN_JUDGEMENT`).
## How to produce training data
You might collect data for use with your machine learning algorithm relying on:
* **Users Interactions**: given a specific query, it is possible to log all the users interactions (e.g., clicks, shares on social networks, send by email etc), and then use them as proxies for relevance;
* **Human Judgements**: A training dataset is produced by explicitly asking some judges to evaluate the relevance of a document given the query.
### How to prepare training data from interaction data?
There are many ways of preparing interaction data for training a model, and it is outside the scope of this readme to provide a complete review of all the techniques. In the following we illustrate a simple way for obtaining training data from simple interaction data.
Simple interaction data will be a log file generated by your application after it
has talked to Solr. The log will contain two different types of record:
* **query**: when a user performs a query we have a record with `user-id, query, responses`,
where `responses` is a list of unique document ids returned for a query.
**Example:**
```
diego, hard drive, [SP2514N,6H500F0,F8V7067-APL-KIT,IW-02]
```
* **click**: when a user performs a click we have a record with `user-id, query, document-id, click`
**Example:**
```
christine, hard drive, SP2154N
diego , hard drive, SP2154N
michael , hard drive, SP2154N
joshua , hard drive, IW-02
```
Given a log composed by records like these, a simple way to produce a training dataset is to group on the query field
and then assign to each query a relevance score equal to the number of clicks: