0

I am testing Solr 9.0 with this tutorial:

https://solr.apache.org/guide/solr/latest/getting-started/tutorial-techproducts.html

I used this query:

http://localhost:8983/solr/techproducts/select?q=cat:electronics&fl=name

In the results displayed, it only gives a masScore. How to display each individual score for each result?

"response": {
    "numFound": 12,
    "start": 0,
    "maxScore": 0.5244061,
    "numFoundExact": true,
    "docs": [
      {
        "name": "Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133"
      },
      {
        "name": "Maxtor DiamondMax 11 - hard drive - 500 GB - SATA-300"
      },
      {
        "name": "Belkin Mobile Power Cord for iPod w/ Dock"
      },
marlon
  • 6,029
  • 8
  • 42
  • 76

1 Answers1

1

You can read individual document scores as an additional field in the results via the fl (Field List) parameter.

The fl parameter limits the information included in a query response to a specified list of fields. The fields must be either stored="true" or docValues="true".

The field list can be specified as a space-separated or comma-separated list of field names. The string score can be used to indicate that the score of each document for the particular query should be returned as a field. The wildcard character * selects all stored fields in the document.

http://localhost:8983/solr/techproducts/select?q=cat:electronics&fl=name,score
EricLavault
  • 12,130
  • 3
  • 23
  • 45
  • Yes, it worked. What does 'stored=true or docValues=true' mean exactly? – marlon Sep 14 '22 at 19:15
  • These are [field properties](https://solr.apache.org/guide/solr/latest/indexing-guide/fields.html#field-properties) defined in the schema. The content of a field has to be _indexed_ to be searchable, and _stored_ to be read. `stored="true"` means the actual content of the field is stored verbatim. `docValues="true"` means the content of the field will be put in a column-oriented structure, and because [docValues are (by default) always stored](https://stackoverflow.com/a/56290437/2529954), it also enables a field to be read. – EricLavault Sep 15 '22 at 16:02