GitHub user jurgenf created a discussion: Nouveau relevancy sorting when no 
sort parameter is given.

The documentation states that if you do a search query on a Nouveau index, the 
results are ordered by relevance:
> If you do not provide a sort parameter, relevance is used by default. The 
> highest scoring matches are returned first.
https://docs.couchdb.org/en/stable/ddocs/nouveau.html#relevance

However, when I do a search for example:
```JSON
{
    "q": "(projectKey:KEY*^4) OR (projectName:KEY~)"
}
```

The result looks as follows:

```JSON
{
  "update_latency": 11,
  "total_hits_relation": "EQUAL_TO",
  "total_hits": 5,
  "ranges": null,
  "hits": [
    {
      "order": [
        {
          "value": 0.823529,
          "@type": "float"
        },
        {
          "value": "KEYB",
          "@type": "string"
        }
      ],
      "id": "KEYB",
      "fields": {
           [...]
      }
    },
    {
      "order": [
        {
          "value": 4.5334044,
          "@type": "float"
        },
        {
          "value": "KEYA",
          "@type": "string"
        }
      ],
      "id": "KEYA",
      "fields": {
           [...]
      }
    },
[...]
```
My expectation was that `KEYA` with it's 4+ score would appear as the first 
item in the hits array. If I page the resultset, higher scoring items can also 
appear on the next page/pages.

Is my understanding of the relevancy sorting incorrect or should the second hit 
be the first item in the `hits` array?

GitHub link: https://github.com/apache/couchdb/discussions/5736

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]

Reply via email to